1
0
Fork 0
mirror of https://github.com/perlbot/perlbuut synced 2025-06-07 10:45:40 -04:00

make error message clearer

This commit is contained in:
Ryan Voots 2017-04-18 11:03:57 -04:00
parent a386dd2c5e
commit 22ec899271

View file

@ -40,7 +40,31 @@ sub spawn_eval {
}
warn "Spawning Eval: $args->{code}\n";
my $wheel = POE::Wheel::Run->new(
Program => sub { system($^X, $filename); print "[Died $?]" if $? },
Program => sub { system($^X, $filename);
my ($exit, $signal) = (($?&0xFF00)>>8, $?&0xFF);
if ($exit) {
print "[Exited $exit]";
} elsif ($signal) {
my $signame = {
1 => "SIGHUP",
2 => "SIGINT",
3 => "SIGQUIT",
4 => "SIGILL",
5 => "SIGTRAP",
6 => "SIGABRT",
7 => "SIGBUS",
8 => "SIGFPE",
9 => "SIGKILL",
11 => "SIGSEGV",
13 => "SIGPIPE",
14 => "SIGALRM",
15 => "SIGTERM",
31 => "SIGSYS (Illegal Syscall)",
}->{$signal} // $signal;
print "[Died $signame]";
}
},
ProgramArgs => [ ],
CloseOnCall => 1, #Make sure all of the filehandles are closed.