Fixed bug #47608: parallel --nonall -S lo 'echo ::: ' blocks.

This commit is contained in:
Ole Tange 2016-04-06 00:33:34 +02:00
parent 38445ee49e
commit 4a1abba854
3 changed files with 11 additions and 2 deletions

View file

@ -1031,11 +1031,13 @@ sub parse_options {
$opt::compress_program ||= $compress; $opt::compress_program ||= $compress;
$opt::decompress_program ||= $decompress; $opt::decompress_program ||= $decompress;
} }
if(defined $opt::nonall if(defined $opt::nonall) {
and not grep /\Q$Global::arg_sep\E|\Q$Global::arg_sep\E/, @ARGV) {
# Append a dummy empty argument if there are no arguments # Append a dummy empty argument if there are no arguments
# on the command line to avoid reading from STDIN. # on the command line to avoid reading from STDIN.
# arg_sep = random 50 char
# \0 => nothing (not the empty string) # \0 => nothing (not the empty string)
$Global::arg_sep = join "",
map { (0..9,"a".."z","A".."Z")[rand(62)] } (1..50);
push @ARGV, $Global::arg_sep, "\0"; push @ARGV, $Global::arg_sep, "\0";
} }
if(defined $opt::tty) { if(defined $opt::tty) {

View file

@ -74,4 +74,7 @@ echo '### bug #45907: --header : + --return {header}'
ppar --header : -S parallel@lo --return {G} --cleanup echo {G} '>' {G} ::: G returnfile45907; ppar --header : -S parallel@lo --return {G} --cleanup echo {G} '>' {G} ::: G returnfile45907;
ls returnfile45907 ls returnfile45907
echo "### bug #47608: parallel --nonall -S lo 'echo ::: ' blocks"
parallel --nonall -S lo 'echo ::: '
EOF EOF

View file

@ -113,3 +113,7 @@ echo '### bug #45907: --header : + --return {header}'
### bug #45907: --header : + --return {header} ### bug #45907: --header : + --return {header}
rm returnfile45907; ppar --header : -S parallel@lo --return {G} --cleanup echo {G} '>' {G} ::: G returnfile45907; ls returnfile45907 rm returnfile45907; ppar --header : -S parallel@lo --return {G} --cleanup echo {G} '>' {G} ::: G returnfile45907; ls returnfile45907
returnfile45907 returnfile45907
echo "### bug #47608: parallel --nonall -S lo 'echo ::: ' blocks"
### bug #47608: parallel --nonall -S lo 'echo ::: ' blocks
parallel --nonall -S lo 'echo ::: '
:::