diff options
| author | Andreas Guldstrand <andreas.guldstrand@gmail.com> | 2015-12-31 22:17:11 +0100 | 
|---|---|---|
| committer | Andreas Guldstrand <andreas.guldstrand@gmail.com> | 2015-12-31 22:17:11 +0100 | 
| commit | 0ac3f4cccdaa429b8fdb718db798f09afdab0a0c (patch) | |
| tree | 1bbc6156873503ba9e8d771c265cd066554fd5dd /SBO-Lib/lib | |
| parent | 99f905d30cc0f70055be81e42a2cb15345976a07 (diff) | |
| download | sbotools2-0ac3f4cccdaa429b8fdb718db798f09afdab0a0c.tar.xz | |
Fix bug where a failing convertpkg-compat32 wasn't noticed.
Diffstat (limited to 'SBO-Lib/lib')
| -rw-r--r-- | SBO-Lib/lib/SBO/Lib.pm | 16 | 
1 files changed, 14 insertions, 2 deletions
diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index 664ee32..066dc12 100644 --- 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;  	}  | 
