bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#56025: [WIP PATCH] 29.0.50; em-extpipe-test-2 times out on EMBA and


From: Jim Porter
Subject: bug#56025: [WIP PATCH] 29.0.50; em-extpipe-test-2 times out on EMBA and Cygwin
Date: Sun, 17 Jul 2022 10:44:26 -0700

On 7/16/2022 11:03 PM, Eli Zaretskii wrote:
Could you please describe the main ideas of the changeset?  It is hard
to be sure I understand what you are trying to do by reading the
patch.

Sure. I mentioned it briefly earlier in the thread, but a more-complete summary would probably help.

Normally, Eshell connects programs in a pipeline like "foo | bar" by setting a process filter for "foo", and inside that filter, (eventually) calling `process-send-string' for "bar". In most shells, you'd expect that connection to be a pipe, but in Eshell, the processes are created with a PTY connection by default.

My patch adds support for `make-process' to use a PTY only for the child process's stdin or its stdout (in addition to the preexisting behaviors of PTY for both or neither). This then lets Eshell request a pipe for foo's stdout and bar's stdin, while using PTYs for foo's stdin and bar's stdout:

  Before:
    [pty 1] -> foo -> [pty 1] -> Eshell -> [pty 2] -> bar -> [pty 2]

  After:
    [pty 1] -> foo -> [pipe] -> Eshell -> [pipe] -> bar -> [pty 2]

This should make Eshell behave quite a bit more similarly to other shells, which will hopefully reduce the number of bugs like this one. This change also allowed me to remove the workaround for bug#1388. In that bug, there was an issue where this command didn't work[1]:

  *echo 1+1 | bc

Before the fix for bug#1388, "bc" would have seen that its stdin was a PTY, and then started an interactive session. Bug#1388 fixed this by adding `eshell-needs-pipe-p' to identify specific programs that need a pipe connection when being piped to like the above. With my patch here, that workaround won't be necessary anymore, since programs in a pipeline will be connected via pipes. (Note that technically, this pipe connection is indirect, since there's one pipe from foo to Emacs, and another pipe from Emacs to bar.)

This patch should hopefully fix the issues on Cygwin (as described in this bug) because, when using pipes to connect programs, the behavior should be more consistent across multiple platforms.

[1] I'm using "*echo" here to use /bin/echo so that it writes a newline. Eshell's built-in echo doesn't write a newline by default.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]