From 26606a5501b97f730ba1fe85a47f8bfc7d559bc9 Mon Sep 17 00:00:00 2001 From: Ole Tange Date: Wed, 29 Jul 2015 02:33:28 +0200 Subject: [PATCH] Fixed bug #45619: "--halt" erroneous error exit code. --- src/parallel | 3 ++- testsuite/tests-to-run/parallel-local-0.3s.sh | 6 ++++++ testsuite/wanted-results/parallel-local-0.3s | 5 +++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/parallel b/src/parallel index a4d044f1..2b1d2447 100755 --- a/src/parallel +++ b/src/parallel @@ -167,7 +167,8 @@ if($opt::halt and $Global::halt_when ne "never") { $Global::halt_exitstatus = ::ceil($Global::total_failed / $Global::total_started * 100); } elsif($Global::halt_count) { - $Global::halt_exitstatus = ::min($Global::total_failed,101); + $Global::halt_exitstatus = + ::min(undef_as_zero($Global::total_failed),101); } } wait_and_exit($Global::halt_exitstatus); diff --git a/testsuite/tests-to-run/parallel-local-0.3s.sh b/testsuite/tests-to-run/parallel-local-0.3s.sh index 7def4be6..625e8461 100644 --- a/testsuite/tests-to-run/parallel-local-0.3s.sh +++ b/testsuite/tests-to-run/parallel-local-0.3s.sh @@ -17,6 +17,12 @@ export SMALLDISK ) >/dev/null 2>/dev/null cat <<'EOF' | sed -e 's/;$/; /;s/$SERVER1/'$SERVER1'/;s/$SERVER2/'$SERVER2'/' | stdout parallel -vj0 -k --joblog /tmp/jl-`basename $0` -L1 +echo '### Test bug #45619: "--halt" erroneous error exit code (should give 0)'; + seq 10 | parallel --halt now,fail=1 true; + echo $? + +echo '**' + echo '### Test exit val - true'; echo true | parallel; echo $? diff --git a/testsuite/wanted-results/parallel-local-0.3s b/testsuite/wanted-results/parallel-local-0.3s index 475d5db7..91a0399e 100644 --- a/testsuite/wanted-results/parallel-local-0.3s +++ b/testsuite/wanted-results/parallel-local-0.3s @@ -1,3 +1,8 @@ +echo '### Test bug #45619: "--halt" erroneous error exit code (should give 0)'; seq 10 | parallel --halt now,fail=1 true; echo $? +### Test bug #45619: "--halt" erroneous error exit code (should give 0) +0 +echo '**' +** echo '### Test exit val - true'; echo true | parallel; echo $? ### Test exit val - true 0