pv-adverb: Improve test coverage, fix behaviour in various corner cases
Continuation from !671 (merged).
-
tests: Use a symbolic constant for STDERR_FILENO
Naming copied from C into Python.
-
Report an unknown wait-status in the same way bubblewrap does
This just makes our tools a little more consistent with each other.
-
pv-adverb: Distinguish between exit status 126 and 127
Mimicking env(1), return 127 if the executable was not found, or 126 if it could not be run for whatever reason.
-
adverb test: Exercise ENOENT vs. other startup errors
-
pv-adverb: Don't require target of --assign-fd to be a valid fd yet
If we're doing
pv-adverb --assign-fd=9=1
(the equivalent of9>&1
in the shell), then fd 1 needs to be a valid fd already, but fd 9 does not.This was not a problem in practice because pressure-vessel currently only assigns to fds 1 and 2 (stdout and stderr), which we ensure are always valid, even if that means opening /dev/null.
Fixes: 4329cec7 "pv-adverb: Add --assign-fd"
-
adverb test: Add coverage for a valid fd assignment
-
tests: Exercise pv-adverb --lock-file
-
tests: Exercise pv-adverb --fd
-
tests: Exercise more invalid arguments to pv-adverb
-
pv-adverb: Exit 255 if we somehow lose the main process
If waiting for child processes fails with ECHILD, that would signify that our main process was somehow reparented away, or was reaped by another thread. This shouldn't happen, but if it does, it makes sense to report it as equivalent to exiting with an unknown status, instead of the current EX_UNAVAILABLE.