Hi! script(1) always exits 0 if it's successful. This can be worked around, of course, but at least a flag enabling this is semi-ubiquitous among other implementations (util-linux has -e, FreeBSD always passes the exit status through and accepts a no-op -e, OpenBSD tried and failed to implement this, patches pending to fix it). I haven't figured out how to make less than a big blob via CVS, so this patchset originates from a git import of the latest src/usr.bin/script/ directory. 1-3/6 are misc. cleanups I noticed when implementing this. I tried to make these as small and atomic as possible; there are, of course, ways to meld them together if you'd rather them be bigger; it's possible, also, that you'd prefer passthrough to happen always: in this case 5/6 needs to be dropped and 6/6 reworded. Best, наб (6): script.c: fix usage string script.c: use sh -c directly instead of system(3) script.1: clarify that -c runs the argument via sh -c script.c: exit with the exit code of the child script.c: gate child exit code on -e flag script.1: note -e flag script.1 | 14 +++++++++----- script.c | 51 +++++++++++++++++++++++++-------------------------- 2 files changed, 34 insertions(+), 31 deletions(-) -- 2.30.2
Attachment:
signature.asc
Description: PGP signature