Skip to content

Commit

Permalink
Merge pull request #6075 from neo954/copycds-cpio
Browse files Browse the repository at this point in the history
Handle the exit code properly when `copycds` failed, and pass through outputs of `cpio`
  • Loading branch information
immarvin committed Mar 12, 2019
2 parents 82a9b17 + f9c4c1c commit 442614e
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions xCAT-server/lib/xcat/plugins/anaconda.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2250,7 +2250,7 @@ sub copycd
print $KID $_ . "\n";
}
close($KID);
$rc = $?;
$rc = $? >> 8;
}
else
{
Expand All @@ -2261,22 +2261,18 @@ sub copycd
my $copied = 0;
my ($percent, $fout);
while (<PIPE>) {
next if /^cpio:/;
if (/^cpio:/) {
chomp;
$callback->({ data => $_ });
next;
}
$percent = $copied / $numFiles;
$fout = sprintf "%0.2f%%", $percent * 100;
$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");
Expand All @@ -2297,7 +2293,7 @@ sub copycd

if ($rc != 0)
{
$callback->({ error => "Media copy operation failed, status $rc" });
$callback->({ error => "Media copy operation failed, status $rc", errorcode => [1] });
}
else
{
Expand Down

0 comments on commit 442614e

Please sign in to comment.