On Wed, Feb 18, 2015 at 01:58:34PM +0100, Laurent Bercot wrote:
>
> I'm leaning more and more towards the following approach:
>
> - child crashed: exit 128 + signal number
> - child exited with 128 or more: exit 128
> - else: exit the child's exit code.
>
> Assuming "normal" commands never exit more than 127, that
> reports the whole information to the immediate parent, and
> correct information, if incomplete, higher up. That should
> be enough to make things work in all cases.
>
> Thoughts ?
Hm, just a point here; not saying it's very important, but people
do sometimes use Perl for stuff :) [0]
[roam_at_straylight ~]$ perl -e 'die("foo!\n");'; echo $?
foo!
255
[roam_at_straylight ~]$
Yes, I know, I know, I myself have no idea why die() exits with 255
instead of, say, 1... or rather, yes, I do have an idea (make it
different from any code that a usual program would exit with), but I do
recognize it as weird :(
So, hm, I don't know... Clamp the "killed by a signal" range to
128-191? Unfortunately, I'm not sure (couldn't find it in a quick
browsing of the POSIX specs) whether there is actually a defined maximum
signal number; "anything higher than 63 is reported as 63" might be
an option here. Or, of course, just ignore Perl's die()'s weirdness or
rather wrap it up in "any exit code larger than 128 is unusual enough to
be lumped together with other exit codes larger than 128", as your
proposal already states... so apologies for the wasted electrons, I
guess :)
G'luck,
Peter
[0] ...and, yes, at $RealJob we do use a Perl loader/watcher for several
important daemons... but then we have to keep compatibility with various
init systems, we can't force a choice upon our customers :)
--
Peter Pentchev roam_at_ringlet.net roam_at_FreeBSD.org p.penchev_at_storpool.com
PGP key: http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint 2EE7 A7A5 17FC 124C F115 C354 651E EFB0 2527 DF13
Received on Wed Feb 18 2015 - 13:20:54 UTC