sbotools2

Maintenance fork of the original sbotools version 2
Log | Files | Refs | README

commit 0ac3f4cccdaa429b8fdb718db798f09afdab0a0c
parent 99f905d30cc0f70055be81e42a2cb15345976a07
Author: Andreas Guldstrand <andreas.guldstrand@gmail.com>
Date:   Thu, 31 Dec 2015 22:17:11 +0100

Fix bug where a failing convertpkg-compat32 wasn't noticed.

Diffstat:
MSBO-Lib/lib/SBO/Lib.pm | 16++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm @@ -993,9 +993,21 @@ sub do_convertpkg { my $pkg = shift; my $tempfh = tempfile(DIR => $tempdir); my $fn = get_tmp_extfn($tempfh); + + # get a tempfile to store the exit status of the slackbuild + my $exit_temp = tempfile(DIR => $tempdir); + my ($exit_fn, $exit) = get_tmp_extfn($exit_temp); + return $exit_fn, undef, $exit if $exit; + my $c32tmpd = $env_tmp // '/tmp'; - my $cmd = "/usr/sbin/convertpkg-compat32 -i $pkg -d $c32tmpd | tee $fn"; - if (system($cmd) != 0) { + my $cmd = "( /bin/bash -c '/usr/sbin/convertpkg-compat32 -i $pkg -d $c32tmpd'; echo \$? > $exit_fn ) | tee $fn"; + my $ret = system('/bin/bash', '-c', $cmd); + + # If the system call worked, check the saved exit status + seek $exit_temp, 0, 0; + $ret = do {local $/; <$exit_temp>} if $ret == 0; + + if ($ret != 0) { return "convertpkg-compt32 returned non-zero exit status\n", _ERR_CONVERTPKG; }