Where is the output of an aborted shell command supposed to be found?

Tim Landscheidt <[email protected]>
Newsgroups gmane.emacs.help
Organization https://www.tim-landscheidt.de/
Message-ID <[email protected]>
Hi,

with GNU Emacs 30.2 (Fedora 43), I've stumbled upon some
behaviour that I do not understand at first (and second)
glance.  Consider a shell script stderr-test.sh:

| #!/bin/sh

| /bin/echo Test for stderr. >&2
| /bin/sleep "$1"
| exit 1

(/bin/echo so that it flushes its stderr when finishing.)

If I run M-! sh stderr-test.sh 0 RET, I observe that:

- The echo area displays "Test for stderr.",

- "Test for stderr." is appended to *Messages*, and

- the buffer *Shell Command Output* is created, has the
  "mode" "Fundamental - Exit [1]" and contains "Test for
  stderr."

If I run M-! sh stderr-test.sh 999 RET and abort the process
with C-g:

- The echo area displays "Quit",

- *Messages* is appended with:

  | Waiting for process to die...done
  | (Shell command failed with error)
  | Quit

- and the *Shell Command Output* buffer is empty, but has
  the "mode" "Fundamental - Error".

When I repeat the same test for stdout, it shows the same
results.

My expectation is that when I abort a shell command, *Shell
Command Output* contains all output up to the point of
killing the process (plus/minus buffering), and reading the
docstring for shell-command does not immediately refute
this.

Is the output of an aborted shell command silently
discarded, or is it stored somewhere else?

TIA,
Tim
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.