From 0c48e779c36da1f47d5d7460b3586ab80ffd3d4d Mon Sep 17 00:00:00 2001 From: vallard Date: Mon, 2 Jun 2008 23:58:15 +0000 Subject: [PATCH] made sure cpioid is killed on sig int git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@1559 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server-2.0/lib/xcat/plugins/anaconda.pm | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/xCAT-server-2.0/lib/xcat/plugins/anaconda.pm b/xCAT-server-2.0/lib/xcat/plugins/anaconda.pm index e3bf30bba..8b927ddc1 100644 --- a/xCAT-server-2.0/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server-2.0/lib/xcat/plugins/anaconda.pm @@ -16,7 +16,7 @@ Getopt::Long::Configure("bundling"); Getopt::Long::Configure("pass_through"); use File::Path; use File::Copy; -my $cpiopid; +my @cpiopid; my %distnames = ( "1176234647.982657" => "centos5", @@ -786,7 +786,9 @@ sub copycd my $rc; my $reaped = 0; $SIG{INT} = $SIG{TERM} = sub { - if ($cpiopid) { kill 2, $cpiopid; exit 0; } + foreach(@cpiopid){ + kill 2, $_; + } if ($::CDMOUNTPATH) { system("umount $::CDMOUNTPATH"); } @@ -802,7 +804,7 @@ sub copycd } if ($child) { - $cpiopid = $child; + push @cpiopid, $child; my @finddata = `find .`; for (@finddata) { @@ -815,8 +817,9 @@ sub copycd { nice 10; my $c = "nice -n 20 cpio -vdump $installroot/$distname/$arch"; - open(PIPE, "$c 2>&1 |") || + my $k2 = open(PIPE, "$c 2>&1 |") || $callback->({error => "Media copy operation fork failure"}); + push @cpiopid, $k2; my $copied = 0; my ($percent, $fout); while(){