Subject: bug#48129: 28.0.50; Per file-handle (stdin, stdout and stderr) process-connection-type variable

From: Thomas Hisch <[email-masked]>
Date: Sat, 12 Jun 2021 18:49:40 +0200

On 6/12/21 17:31, Eli Zaretskii wrote:
>> * if a stderr argument is not passed to make-process, then both stdin as
>> well as stdout in the subprocess are connected to pty devices.
>
> Indeed, I forgot that using :stderr with make-process automatically
> resets the process connection typ to use pipes for all the 3 standard
> handles.  I guess there's some technical issue underlying that?

I guess you mean a technical issue in emacs and not in the OS, right?
cpython e.g. doesn't have this limitation. In cpython you can pass
one of the following values to each file handle (stdin, stdout, stderr)
  in the subprocess module:

(see https://docs.python.org/3.10/library/subprocess.html#subprocess.Popen)

subprocess.DEVNULL

     Special value that can be used as the stdin, stdout or stderr
argument to Popen and indicates that the special file os.devnull will be
used.

subprocess.PIPE

     Special value that can be used as the stdin, stdout or stderr
argument to Popen and indicates that a pipe to the standard stream
should be opened. Most useful with Popen.communicate().

subprocess.STDOUT

     Special value that can be used as the stderr argument to Popen and
indicates that standard error should go into the same handle as standard
output.

It is also possible to use

 > an existing file descriptor (a positive integer), an existing file
object, and None.

If you want to assign a file handle to pty you have to pass a file
descriptor to one of the handles (stdin,stdout,stderr)

It would be nice if emacs were as flexible as cpython w.r.t. configuring
file handles for subprocesses.

> Because we had that restriction since day one.  Perhaps using PTYs
> means that stderr must be redirected to the same device as stdout or
> something?
>
Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly prohibited.

IMS Nanofabrication GmbH FN: 208021 p, FB-Gericht: Wien; Sitz: Schreygasse 3, 1020, Vienna (Austria),Tel. +43 1 214 48 94; E-Mail: [email-masked]; DVR-Nr: 0374369; www.ims.co.at