From 82e244082d58c6469509d98fc454e31ce5277068 Mon Sep 17 00:00:00 2001 From: jkratoch <> Date: Thu, 14 Oct 2010 13:25:11 +0000 Subject: [PATCH 1/1] +waitpid status printer. --- bin/whyexit | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 bin/whyexit diff --git a/bin/whyexit b/bin/whyexit new file mode 100755 index 0000000..af5a452 --- /dev/null +++ b/bin/whyexit @@ -0,0 +1,16 @@ +#! /usr/bin/perl +use strict; +use warnings; +use POSIX; +BEGIN { eval 'use Glib;1;' or eval 'sub Glib::strsignal { return "?"; }'; } + +sub WCOREDUMP($) { return $_[0] & 0x80; } +sub WIFCONTINUED($) { return $_[0]==0xffff; } + +my $r=system @ARGV; +$r==$? or die; +die "WEXITSTATUS ".WEXITSTATUS($r)."\n" if WIFEXITED $r; +die "WTERMSIG ".WTERMSIG($r)."=".Glib::strsignal(WTERMSIG($r))." WCOREDUMP=".(WCOREDUMP($r) ? "yes" : "no")."\n" if WIFSIGNALED $r; +die "WSTOPSIG ".WSTOPSIG($r)."=".Glib::strsignal(WSTOPSIG($r))."\n" if WIFSTOPPED $r; +die "WIFCONTINUED\n" if WIFCONTINUED $r; +die "? $r\n"; -- 1.8.3.1