]> git.lizzy.rs Git - rust.git/commit
ExitStatus: print "exit status: {}" rather than "exit code: {}"
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 25 Mar 2021 10:27:53 +0000 (10:27 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 25 Mar 2021 10:27:53 +0000 (10:27 +0000)
commit11e40ce240d884303bee142a727decaeeef43bdb
tree081a7f956f5f91fac437a3e7c3335f423530c31b
parent9b6339e4b9747d473270baa42e77e1d2fff39bf4
ExitStatus: print "exit status: {}" rather than "exit code: {}"

Proper Unix terminology is "exit status" (vs "wait status").  "exit
code" is imprecise on Unix and therefore unclear.  (As far as I can
tell, "exit code" is correct terminology on Windows.)

This new wording is unfortunately inconsistent with the identifier
names in the Rust stdlib.

It is the identifier names that are wrong, as discussed at length in eg
  https://doc.rust-lang.org/nightly/std/process/struct.ExitStatus.html
  https://doc.rust-lang.org/nightly/std/os/unix/process/trait.ExitStatusExt.html

Unfortunately for API stability reasons it would be a lot of work, and
a lot of disruption, to change the names in the stdlib (eg to rename
`std::process::ExitStatus` to `std::process::ChildStatus` or
something), but we should fix the message output.  Many (probably
most) readers of these messages about exit statuses will be users and
system administrators, not programmers, who won't even know that Rust
has this wrong terminology.

So I think the right thing is to fix the documentation (as I have
already done) and, now, the terminology in the implementation.

This is a user-visible change to the behaviour of all Rust programs
which run Unix subprocesses.  Hopefully no-one is matching against the
exit status string, except perhaps in tests.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
library/std/src/sys/unix/process/process_unix.rs
library/std/src/sys/unix/process/process_unix/tests.rs