mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-11-29 09:27:56 +00:00
bug #35069: --pipe without command should give reasonable error message.
This commit is contained in:
parent
2506e775f7
commit
6f3da78d6c
31
src/parallel
31
src/parallel
|
@ -131,7 +131,6 @@ for my $sshlogin (values %Global::host) {
|
||||||
$sshlogin->max_jobs_running();
|
$sshlogin->max_jobs_running();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
init_run_jobs();
|
init_run_jobs();
|
||||||
my $sem;
|
my $sem;
|
||||||
if($Global::semaphore) {
|
if($Global::semaphore) {
|
||||||
|
@ -2318,7 +2317,7 @@ sub processes_available_by_system_limit {
|
||||||
$Global::JobQueue->empty() and last;
|
$Global::JobQueue->empty() and last;
|
||||||
($job) = $Global::JobQueue->get();
|
($job) = $Global::JobQueue->get();
|
||||||
push(@jobs, $job);
|
push(@jobs, $job);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$wait_time_for_getting_args += time - $before_getting_arg;
|
$wait_time_for_getting_args += time - $before_getting_arg;
|
||||||
$system_limit++;
|
$system_limit++;
|
||||||
|
@ -3292,7 +3291,7 @@ sub sshreturn {
|
||||||
$file =~ s:^\./::g; # Remove ./ if any
|
$file =~ s:^\./::g; # Remove ./ if any
|
||||||
my $relpath = ($file !~ m:^/:); # Is the path relative?
|
my $relpath = ($file !~ m:^/:); # Is the path relative?
|
||||||
# Use different subdirs depending on abs or rel path
|
# Use different subdirs depending on abs or rel path
|
||||||
|
|
||||||
# Return or cleanup
|
# Return or cleanup
|
||||||
my @cmd = ();
|
my @cmd = ();
|
||||||
my $rsync_destdir = ($relpath ? "./" : "/");
|
my $rsync_destdir = ($relpath ? "./" : "/");
|
||||||
|
@ -3735,7 +3734,7 @@ sub populate {
|
||||||
::wait_and_exit(255);
|
::wait_and_exit(255);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(defined $self->{'max_number_of_args'}) {
|
if(defined $self->{'max_number_of_args'}) {
|
||||||
if($self->number_of_args() >= $self->{'max_number_of_args'}) {
|
if($self->number_of_args() >= $self->{'max_number_of_args'}) {
|
||||||
last;
|
last;
|
||||||
|
@ -4221,16 +4220,24 @@ sub get {
|
||||||
);
|
);
|
||||||
$cmd_line->populate();
|
$cmd_line->populate();
|
||||||
::debug("cmd_line->number_of_args ".$cmd_line->number_of_args()."\n");
|
::debug("cmd_line->number_of_args ".$cmd_line->number_of_args()."\n");
|
||||||
if(not $::opt_pipe and $cmd_line->number_of_args() == 0) {
|
if($::opt_pipe) {
|
||||||
# We did not get more args - maybe at EOF string?
|
if($cmd_line->replaced() eq "") {
|
||||||
return undef;
|
# Empty command - pipe requires a command
|
||||||
} elsif($cmd_line->replaced() eq "") {
|
print STDERR "$Global::progname: --pipe must have a ".
|
||||||
# Empty command - get the next instead
|
"command to pipe into (e.g. 'cat')\n";
|
||||||
return $self->get();
|
::wait_and_exit(255);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$self->set_seq($self->seq()+1);
|
if($cmd_line->number_of_args() == 0) {
|
||||||
return $cmd_line;
|
# We did not get more args - maybe at EOF string?
|
||||||
|
return undef;
|
||||||
|
} elsif($cmd_line->replaced() eq "") {
|
||||||
|
# Empty command - get the next instead
|
||||||
|
return $self->get();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
$self->set_seq($self->seq()+1);
|
||||||
|
return $cmd_line;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,4 +19,7 @@ seq 2 | stdout parallel -X --eta echo
|
||||||
|
|
||||||
echo '### --timeout on remote machines'
|
echo '### --timeout on remote machines'
|
||||||
parallel -j0 --timeout 3 --onall -S .. 'sleep {}; echo {}' ::: 1 6 7 ; echo $?
|
parallel -j0 --timeout 3 --onall -S .. 'sleep {}; echo {}' ::: 1 6 7 ; echo $?
|
||||||
|
|
||||||
|
echo '### --pipe without command'
|
||||||
|
seq -w 10 | stdout parallel --pipe
|
||||||
EOF
|
EOF
|
||||||
|
|
|
@ -22,3 +22,5 @@ Computers / CPU cores / Max jobs to run
|
||||||
1
|
1
|
||||||
1
|
1
|
||||||
2
|
2
|
||||||
|
### --pipe without command
|
||||||
|
parallel: --pipe must have a command to pipe into (e.g. 'cat')
|
||||||
|
|
|
@ -12,6 +12,7 @@ cat ... | parallel --pipe [options] [command [arguments]]
|
||||||
{3} {3.} {3/} {3/.} Positional replacement strings
|
{3} {3.} {3/} {3/.} Positional replacement strings
|
||||||
|
|
||||||
-S sshlogin Example: foo@server.example.com
|
-S sshlogin Example: foo@server.example.com
|
||||||
|
--slf .. Use ~/.parallel/sshloginfile as the list of sshlogins
|
||||||
--trc {}.bar Shorthand for --transfer --return {}.bar --cleanup
|
--trc {}.bar Shorthand for --transfer --return {}.bar --cleanup
|
||||||
--onall Run the given command with argument on all sshlogins
|
--onall Run the given command with argument on all sshlogins
|
||||||
--nonall Run the given command with no arguments on all sshlogins
|
--nonall Run the given command with no arguments on all sshlogins
|
||||||
|
|
Loading…
Reference in a new issue