From dd394f6f6e1c6d2030d639d7ebcf4d62f1d38e4f Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Tue, 12 Mar 2019 15:30:25 +0800 Subject: [PATCH] Handle the exit code of child process properly --- xCAT-server/lib/xcat/plugins/anaconda.pm | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index 68011078a..238a6724a 100644 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -2250,7 +2250,7 @@ sub copycd print $KID $_ . "\n"; } close($KID); - $rc = $?; + $rc = $? >> 8; } else { @@ -2267,16 +2267,8 @@ sub copycd $callback->({ sinfo => "$fout" }); ++$copied; } - if ($copied == $numFiles) - { - #media copy success - exit(0); - } - else - { - #media copy failed - exit(1); - } + close(PIPE); + exit($? >> 8); } #my $rc = system("cd $path; find . | nice -n 20 cpio -dump $installroot/$distname/$arch");