mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-11-22 14:07:55 +00:00
parallel: :::: - (stdin) also works. Test added for ::: and ::::
This commit is contained in:
parent
0f7fdcdffb
commit
ba6af9c3d2
|
@ -720,6 +720,7 @@ sub open_or_exit {
|
||||||
# exits if file cannot be opened
|
# exits if file cannot be opened
|
||||||
my $file = shift;
|
my $file = shift;
|
||||||
if($file eq "-") {
|
if($file eq "-") {
|
||||||
|
$Global::stdin_in_opt_a = 1;
|
||||||
return ($Global::original_stdin || *STDIN);
|
return ($Global::original_stdin || *STDIN);
|
||||||
}
|
}
|
||||||
if(ref $file eq "GLOB") {
|
if(ref $file eq "GLOB") {
|
||||||
|
@ -3016,7 +3017,7 @@ sub start {
|
||||||
$pid = ::open3($in, ">&OUT", ">&ERR", $command) ||
|
$pid = ::open3($in, ">&OUT", ">&ERR", $command) ||
|
||||||
::die_bug("open3-pipe");
|
::die_bug("open3-pipe");
|
||||||
$job->set_stdin($in);
|
$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
|
# Give STDIN to the first job if using -a
|
||||||
*IN = *STDIN;
|
*IN = *STDIN;
|
||||||
$pid = ::open3("<&IN", ">&OUT", ">&ERR", $command) ||
|
$pid = ::open3("<&IN", ">&OUT", ">&ERR", $command) ||
|
||||||
|
|
|
@ -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 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) 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
|
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<argfiles>
|
=item B<::::> I<argfiles>
|
||||||
|
|
||||||
|
|
20
testsuite/tests-to-run/test58.sh
Normal file
20
testsuite/tests-to-run/test58.sh
Normal file
|
@ -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
|
79
testsuite/wanted-results/test58
Normal file
79
testsuite/wanted-results/test58
Normal file
|
@ -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
|
Loading…
Reference in a new issue