Before this we'd encounter this bug:

    $ src/parallel --nn --halt-on-error soon,fail=100% 'echo {}' ::: $() 
</dev/null; echo $?
    Illegal division by zero at src/parallel line 217.
    10

Now we'll exit with zero, as we should when we have nothing to do.
---
 src/parallel | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/parallel b/src/parallel
index 46b07da..9f42f08 100755
--- a/src/parallel
+++ b/src/parallel
@@ -216,7 +216,7 @@ sub halt {
            if($Global::halt_pct) {
                $Global::halt_exitstatus =
                    ::ceil($Global::total_failed /
-                          $Global::total_started * 100);
+                          ($Global::total_started || 1) * 100);
            } elsif($Global::halt_count) {
                $Global::halt_exitstatus =
                    ::min(undef_as_zero($Global::total_failed),101);
-- 
2.20.1.415.g653613c723


Reply via email to