EXECLINE-EXITCODES(7)
π EXECLINE-EXITCODES(7) β like, the whole "how do I pass exit codes up the family tree" situation
okay so this is a page from the Miscellaneous Information Manual, and it's called execline-exitcodes β say it with me, bestie: execline-exitcodes(7) π
β¨ NAME β¨
execline-exitcodes β how to propagate exit codes up a process dynasty π
πΈ DESCRIPTION πΈ
so picture this. we've got a parent process P, right? and P is the child of a grandparent process G. and P spawns a child process C and then just... waits for it. classic. either C dies normally with an exit code from 0 to 255, or it gets killed by a signal. so the question is: how do we make sure P reports to G what actually happened to C, like, with as much precision as possible?? π
here's the problem, and it's lowkey tragic: there's more information in a wstat (that's the structure filled in by waitpid(2)) than a process can report by simply exiting. sure, P could exit with the same exit code as C β but then what's it supposed to do if C got killed by a signal? π
so one idea is: have P kill itself with the same signal that killed C. cute in theory! but actually no, that's not right, because P itself could get killed by a signal from another source, and G genuinely needs that info. "P has been killed by a signal" and "C has been killed by a signal" are two completely different pieces of information, so they should not be reported in the same way. periodt. π
so yeah, any way you look at it, there is always more information than we can report. that's just the vibes. π
shells have their own convention[1] for reporting crashes, but since any exit code greater than 127 is reported as is, the information given by the shell is unreliable: "child exited 129" and "child was killed by SIGHUP" are indistinguishable. π and when shells get nested? all bets are off β the information conveyed by exit codes becomes devoid of meaning pretty fast. we need something better, fr fr.
π¦ execline's solution π¦
execline commands such as if(1), that can report a child's exit code, proceed that way when they're in the position of P:
- If
Cwas killed by a signal:Pexits128plus the signal number. π₯ - If
Cexited128or more:Pexits128. - Else,
Pexits with the same code asC.
rationale (aka why this slaps):
128+ exit codes are extremely rare and should report really problematic conditions; commands usually exit127or less. so ifCexits128+, it's more important to convey the information "something really bad happened, but theCprocess itself was not killed by a signal" than the exact nature of the event. the vibe matters more than the details, iykyk.- commands following that convention can be nested. if
Pexits129+,Gknows thatCwas killed by a signal. ifGalso needs to report that to its parent, it will exit128:G's parent will not know the signal number, but it will know thatPreported128or more, so eitherCor a scion ofChad problems. it's giving generational trauma but make it exit codes π§ - exact information is reported in the common case. slay.
β Summary of common exit codes for execline programs β
0β Success. this code is rarely encountered, because most execline programs chainload into something else when they succeed, instead of exiting0. main character energy: they simply don't stick around π«100β Wrong usage.111β System call failed.126β Unable to chainload into another program (any other error thanENOENT).127β Unable to chainload into another program (executable not found).
π SEE ALSO π
[1] https://pubs.opengroup.org/onlinepubs/9799919799/utilities/V3_chap02.html#tag_18_08_02
this man page is ported from the authoritative documentation at: https://skarnet.org/software/execline/exitcodes.html π
π AUTHORS π
- Laurent Bercot
- Alexis <flexibeast@gmail.com> (man page port)
and that's the whole page, bestie π«Ά this came to you straight from Debian, dated March 13, 2022 β mwah, go propagate some exit codes responsibly πβ¨
π¦ where this page comes from
- nixpkgs unstable: execline 2.9.9.2
- nixpkgs unstable: execline-man-pages 2.9.9.1.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms