This manual page provides details for the EXIT STATUS. This should be added.
Scott Cheloha <scottchel...@gmail.com> wrote: > Align timeout(1)'s execvp(3) failure statuses with those of GNU > timeout. 127 for ENOENT, 126 for everything else. > > $ cd /tmp > $ touch script.sh > $ ls -l script.sh > -rw-r--r-- 1 ssc wheel 0 Oct 15 13:43 script.sh > $ gtimeout 1.0 ./script.sh ; echo $? > gtimeout: failed to run command './script.sh': Permission denied > 126 > $ timeout 1.0 ./script.sh ; echo $? > timeout: ./script.sh: Permission denied > 1 > $ gtimeout 1.0 ./not-a-script.sh ; echo $? > gtimeout: failed to run command './not-a-script.sh': No such file or directory > 127 > $ timeout 1.0 ./not-a-script.sh ; echo $? > timeout: ./not-a-script.sh: No such file or directory > 1 > > While here, _exit(2) from the child process instead of exit(3). > > ok? > > Index: timeout.c > =================================================================== > RCS file: /cvs/src/usr.bin/timeout/timeout.c,v > retrieving revision 1.25 > diff -u -p -r1.25 timeout.c > --- timeout.c 13 Jan 2023 06:53:04 -0000 1.25 > +++ timeout.c 15 Oct 2023 18:47:04 -0000 > @@ -260,7 +260,8 @@ main(int argc, char **argv) > signal(SIGTTOU, SIG_DFL); > > execvp(argv[0], argv); > - err(1, "%s", argv[0]); > + warn("%s", argv[0]); > + _exit(errno == ENOENT ? 127 : 126); > } > > /* parent continues here */ >