perl - Name of signal number 2 -


i wondered if there module or pragma defines names signal numbers returned system call? example:

use feature qw(say); use strict; use warnings;  $cmd = 'sleep 10'; $res = system $cmd; $signal = $res & 127; if ( $res == -1 ) {     die "failed execute: $!\n"; } elsif ( $signal == 2 ) {     " aborted user."; } elsif ( $signal ) {     printf " command '%s' died signal %d, %s coredump.\n",       $cmd, $signal, ( $? & 128 ) ? 'with' : 'without'; } 

instead of $signal == 2, think code maintenance, better use $signal == sig_abrt..

yes, defined in posix module:

% perl -e 'use posix; printf "%s\n", sigabrt;' 6 

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -