Exit with the given status for negative `halt_error` codes (#3660)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
halt_error with a negative exit code did not exit with that code. The code collided with the internal status values for null or false output and for no output, so halt_error(-1) exited with 0, or with 1 under --exit-status. Keep the low 8 bits of a negative code, as exit(3) does on POSIX systems, so halt_error(-1) now exits with 255 and halt_error(-2) with 254, the same with or without --exit-status. Under --exit-status this replaces the previous absolute value, so halt_error(-2) used to exit with 2 and halt_error(-255) with 255, and they now exit with 254 and 1.
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
2 files+15 added−2 removed
- tests:+9 added−0 removed
- other:+6 added−2 removed