GNU bug report logs - #79079
31.0.50; Piped command output is sometimes lost in Eshell

Previous Next

Package: emacs;

Reported by: Daniel Mendler <mail <at> daniel-mendler.de>

Date: Wed, 23 Jul 2025 09:57:01 UTC

Severity: normal

Found in version 31.0.50

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Jim Porter <jporterbugs <at> gmail.com>
Cc: mail <at> daniel-mendler.de, eggert <at> cs.ucla.edu, 79079 <at> debbugs.gnu.org
Subject: bug#79079: 31.0.50; Piped command output is sometimes lost in Eshell
Date: Sat, 16 Aug 2025 09:04:27 +0300
> Date: Fri, 15 Aug 2025 13:55:27 -0700
> From: Jim Porter <jporterbugs <at> gmail.com>
> Cc: mail <at> daniel-mendler.de, eggert <at> cs.ucla.edu, 79079 <at> debbugs.gnu.org
> 
>  	      else if (errno == EPIPE)
>  		{
> -		  p->raw_status_new = 0;
> -		  pset_status (p, list2 (Qexit, make_fixnum (256)));
> -		  p->tick = ++process_tick;
> -		  deactivate_process (proc);
> +		  close_process_fd(&p->open_fd[WRITE_TO_SUBPROCESS]);
                                  ^
SPC before the open parenthesis missing there.

> +(defun process-tests/broken-pipe (connection-type)
> +  "Test handling of broken pipes; see bug#79079.
> +This test runs a shell script that reads a line of text and closes
> +stdin.  We send two lines of text to the script; the second should
> +signal an error indicating that the pipe has been closed.  The script
> +should also run to completion, printing out the line of text it read."
> +  (with-temp-buffer
> +    (let ((saw-error nil)
> +          (proc (make-process
> +                 :name "test" :buffer (current-buffer)
> +                 :command '("sh" "-c"
> +                            "read line; exec 0<&-; sleep 1; echo $line")

This will not work on Windows.  Can you come up with a test which
doesn't use features specific Posix shells?  E.g., can you perhaps use
Emacs itself as the other end of the pipe, running some special Lisp
program?

> +  (ert-deftest process-tests/broken-pipe/pty ()
> +    (process-tests/broken-pipe 'pty))
> +
> +  (ert-deftest process-tests/broken-pipe/pipe-stdin ()
> +    (process-tests/broken-pipe '(pipe . pty)))
> +
> +  (ert-deftest process-tests/broken-pipe/pty-stdin ()
> +    (process-tests/broken-pipe '(pty . pipe))))
> +

The PTY tests should be skipped on Windows, since PTYs aren't
supported there.

Thanks.




This bug report was last modified 32 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.