kill child process if xcat command stopped by signal

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@3884 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
wanghuaz 2009-07-28 07:56:43 +00:00
parent 4bbc896185
commit 0a6dc4ad6e
2 changed files with 13 additions and 2 deletions

View File

@ -219,7 +219,12 @@ sub do_rnetboot {
#######################################
# Execute command
#######################################
if ( !open( OUTPUT, "$cmd 2>&1 |")) {
my $pid = open( OUTPUT, "$cmd 2>&1 |");
$SIG{INT} = $SIG{TERM} = sub { #prepare to process job termination and propogate it down
kill 9, $pid;
exit 0;
};
if ( !$pid ) {
return( [RC_ERROR,"$cmd fork error: $!"] );
}
#######################################

View File

@ -294,9 +294,15 @@ sub do_getmacs {
#######################################
# Execute command
#######################################
if ( !open( OUTPUT, "$cmd 2>&1 |")) {
my $pid = open( OUTPUT, "$cmd 2>&1 |");
$SIG{INT} = $SIG{TERM} = sub { #prepare to process job termination and propogate it down
kill 9, $pid;
exit 0;
};
if ( !$pid ) {
return( [RC_ERROR,"$cmd fork error: $!"] );
}
#######################################
# Get command output
#######################################