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

From: Thomas Hisch <[email-masked]>
Date: Fri, 7 May 2021 21:46:15 +0200

On 5/2/21 12:19, Thomas Hisch wrote:
> On 5/1/21 8:09 AM, Eli Zaretskii wrote:
>>> From: Thomas Hisch <[email-masked]>
>>> Date: Sat, 1 May 2021 01:10:10 +0200
>>>
>>>
>>> I would like that the configuration options of the three file
>>> handles (stdin, stdout and stderr), when a new process is created
>>> in emacs, are improved.  What I'm specifically asking for is to
>>> add support for individually specifying for each file-handle
>>> whether it should be connected to a pty or not.  Currently the
>>> value of the process-connection-type variable applies to all
>>> three file handles at once, which leads to a problem with the
>>> following use-case:
>>>
>>> Usually a program outputs ANSI escape sequences when its stdout
>>> file-handle is connected to a pty. It is currently not possible to
>>> communicate with a subprocess that is created by `start-file-process' by
>>> writing to a pty (via stdin) and avoiding that this subprocess writes
>>> ANSI escape sequences to stdout. This use-case is needed by magit, which
>>> currently doesn't have support for displaying ANSI escape sequences but
>>> it needs to communicate with it's started subprocesses via a PTY
>>> (https://github.com/magit/magit/issues/3549).
>>
>> We have make-pipe-process; can't you solve your problem by connecting
>> your process's stdout to such a pipe-process?  If not, why not?
>>
>
> Thx Eli for the fast reply! I had to study the docs of make-pipe-process
> and make-process to understand what you mean. However, I'm not fully
> sure if I fully get what you mean.
>
> AFAICS the pipe process which is returned by make-pipe-process can be
> passed to the :stderr keyword argument of make-process. Is that what you
> head in mind?
>
> According to the docs of make-process, process-connection-type is
> ignored if :stderr is passed to make-process:
>
>>  This parameter and the value of ‘process-connection-type’ are
> ignored if a non-‘nil’ value is specified for the ‘:stderr’ parameter;
> in that case, the type will always be ‘pipe’.
>
> What I want is that stdout and stderr are connected to a pipe but stdin
> is connected to a pty.
>
> Here is the new test script that I used
>
> (let* (
>       (stderr-buffer (get-buffer-create "*stderr*"))
>       (stderr-proc (make-pipe-process :name "stderr"
>                       :buffer stderr-buffer))
>       (process-buf (get-buffer-create "*temp*")))
>     (make-process
>      :name "isatty"
>      :buffer process-buf ;; it is not possible to pass the output of
> make-pipe-process to :buffer
>      :connection-type 'pty ;; unfortunately ignored if :stderr is used
>      :stderr stderr-proc
>      :command (list "/tmp/output-isatty.py")))
>

Eli can you tell me if you meant that we should use make-process in
combination with make-pipe-process?

Best regards
Thomas
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