diff --git a/src/parallel b/src/parallel index 698fe9ff..4adcceb9 100755 --- a/src/parallel +++ b/src/parallel @@ -720,6 +720,7 @@ sub open_or_exit { # exits if file cannot be opened my $file = shift; if($file eq "-") { + $Global::stdin_in_opt_a = 1; return ($Global::original_stdin || *STDIN); } if(ref $file eq "GLOB") { @@ -3016,7 +3017,7 @@ sub start { $pid = ::open3($in, ">&OUT", ">&ERR", $command) || ::die_bug("open3-pipe"); $job->set_stdin($in); - } elsif(@::opt_a and $job->seq() == 1) { + } elsif(@::opt_a and not $Global::stdin_in_opt_a and $job->seq() == 1) { # Give STDIN to the first job if using -a *IN = *STDIN; $pid = ::open3("<&IN", ">&OUT", ">&ERR", $command) || diff --git a/src/parallel.pod b/src/parallel.pod index 5e8ffc58..678d392d 100644 --- a/src/parallel.pod +++ b/src/parallel.pod @@ -191,6 +191,8 @@ B<:::> and B<::::> can be mixed. So these are equivalent: parallel echo {1} {2} {3} :::: <(seq 6 7) <(seq 4 5) :::: <(seq 1 3) parallel -a <(seq 6 7) echo {1} {2} {3} :::: <(seq 4 5) :::: <(seq 1 3) parallel -a <(seq 6 7) -a <(seq 4 5) echo {1} {2} {3} ::: 1 2 3 + seq 6 7 | parallel -a - -a <(seq 4 5) echo {1} {2} {3} ::: 1 2 3 + seq 4 5 | parallel echo {1} {2} {3} :::: <(seq 6 7) - ::: 1 2 3 =item B<::::> I diff --git a/testsuite/tests-to-run/test58.sh b/testsuite/tests-to-run/test58.sh new file mode 100644 index 00000000..705f8240 --- /dev/null +++ b/testsuite/tests-to-run/test58.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +echo '### Test :::: mixed with :::' +echo '### Test :::: < ::: :::' +parallel -k echo {1} {2} {3} :::: <(seq 6 7) ::: 4 5 ::: 1 2 3 + +echo '### Test :::: < < :::: <' +parallel -k echo {1} {2} {3} :::: <(seq 6 7) <(seq 4 5) :::: <(seq 1 3) + +echo '### Test -a :::: < :::: <' +parallel -k -a <(seq 6 7) echo {1} {2} {3} :::: <(seq 4 5) :::: <(seq 1 3) + +echo '### Test -a -a :::' +parallel -k -a <(seq 6 7) -a <(seq 4 5) echo {1} {2} {3} ::: 1 2 3 + +echo '### Test -a - -a :::' +seq 6 7 | parallel -k -a - -a <(seq 4 5) echo {1} {2} {3} ::: 1 2 3 + +echo '### Test :::: < - :::' +seq 4 5 | parallel -k echo {1} {2} {3} :::: <(seq 6 7) - ::: 1 2 3 diff --git a/testsuite/wanted-results/test58 b/testsuite/wanted-results/test58 new file mode 100644 index 00000000..d233a800 --- /dev/null +++ b/testsuite/wanted-results/test58 @@ -0,0 +1,79 @@ +### Test :::: mixed with ::: +### Test :::: < ::: ::: +6 4 1 +6 4 2 +6 4 3 +6 5 1 +6 5 2 +6 5 3 +7 4 1 +7 4 2 +7 4 3 +7 5 1 +7 5 2 +7 5 3 +### Test :::: < < :::: < +6 4 1 +6 4 2 +6 4 3 +6 5 1 +6 5 2 +6 5 3 +7 4 1 +7 4 2 +7 4 3 +7 5 1 +7 5 2 +7 5 3 +### Test -a :::: < :::: < +6 4 1 +6 4 2 +6 4 3 +6 5 1 +6 5 2 +6 5 3 +7 4 1 +7 4 2 +7 4 3 +7 5 1 +7 5 2 +7 5 3 +### Test -a -a ::: +6 4 1 +6 4 2 +6 4 3 +6 5 1 +6 5 2 +6 5 3 +7 4 1 +7 4 2 +7 4 3 +7 5 1 +7 5 2 +7 5 3 +### Test -a - -a ::: +6 4 1 +6 4 2 +6 4 3 +6 5 1 +6 5 2 +6 5 3 +7 4 1 +7 4 2 +7 4 3 +7 5 1 +7 5 2 +7 5 3 +### Test :::: < - ::: +6 4 1 +6 4 2 +6 4 3 +6 5 1 +6 5 2 +6 5 3 +7 4 1 +7 4 2 +7 4 3 +7 5 1 +7 5 2 +7 5 3