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

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

bug#59545: 29.0.50; Eshell fails to redirect output of sourced eshell fi


From: Jim Porter
Subject: bug#59545: 29.0.50; Eshell fails to redirect output of sourced eshell file
Date: Tue, 20 Dec 2022 16:18:54 -0800

On 11/24/2022 7:49 AM, Milan Zimmermann wrote:
Emacs 29 Eshell Bug: Sourcing 'redirect-echo.esh' and redirecting output
to a file, results in the first echo string ('hello') showing in eshell,
only the second ('there')(presumably because it is last) showing in the
output file.

It turns out there's an even simpler way to reproduce this:

  ~ $ {echo hi; echo bye} > #<buf>
  hi  ;; Buffer "buf" now contains the string "bye".

Initially[1], I said that this was an issue with the implementation of 'eshell-protect', but it turns out that it's actually an issue in an adjacent part of the Eshell I/O code. Specifically, every statement in Eshell gets its own set of default I/O handles, when it should actually inherit the handles from its parent. So in the example above, "echo hi" has the default I/O handles (pointing to the terminal), when its stdout handle should point to the buffer "buf".

Attached is a patch series to fix this, with a bunch of new tests. I also fixed a related issue where redirecting to /dev/null could clobber your other redirects. (There's *also* an issue that should be fixed for the release branch; I'll send that in a separate message.)

[1] https://lists.gnu.org/archive/html/emacs-devel/2022-11/msg01504.html

Attachment: 0001-Add-eshell-duplicate-handles-to-return-a-copy-of-fil.patch
Description: Text document

Attachment: 0002-Fix-handling-of-output-handles-in-nested-Eshell-form.patch
Description: Text document

Attachment: 0003-Simplify-handling-of-dev-null-redirection-in-Eshell.patch
Description: Text document


reply via email to

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