Fixed bug #49229: parallel hangs on last ffmpeg command.

First command no longer gets stdin as it causes unpredictable issues.
This commit is contained in:
Ole Tange 2016-10-22 13:39:31 +02:00
parent d5761dcaae
commit a36729cdf3
2 changed files with 8 additions and 31 deletions

View file

@ -2029,13 +2029,11 @@ sub open_or_exit {
# Inputs:
# $file = filehandle or filename to open
# Uses:
# $Global::stdin_in_opt_a
# $Global::original_stdin
# Returns:
# $fh = file handle to read-opened file
my $file = shift;
if($file eq "-") {
$Global::stdin_in_opt_a = 1;
return ($Global::original_stdin || *STDIN);
}
if(ref $file eq "GLOB") {
@ -7804,27 +7802,6 @@ sub start {
};
$Global::tty_taken = $pid;
close $devtty_fh;
} elsif(@opt::a and not $Global::stdin_in_opt_a and $job->seq() == 1
and $job->sshlogin()->string() eq ":") {
# Give STDIN to the first job if using -a (but only if running
# locally - otherwise CTRL-C does not work for other jobs Bug#36585)
local (*IN,*OUT,*ERR);
open OUT, '>&', $stdout_fh or ::die_bug("Can't dup STDOUT: $!");
open ERR, '>&', $stderr_fh or ::die_bug("Can't dup STDERR: $!");
*IN = *STDIN;
# The eval is needed to catch exception from open3
my @setpgrp_wrap = ('perl','-e',
"setpgrp\;eval\{setpriority\(0,0,$opt::nice\)\}\;".
"exec '$Global::shell', '-c', \@ARGV");
eval {
$pid = ::open3("<&IN", ">&OUT", ">&ERR", @setpgrp_wrap, $command)
|| ::die_bug("open3-<IN");
1;
};
# Re-open to avoid complaining
open(STDIN, "<&", $Global::original_stdin)
or ::die_bug("dup-\$Global::original_stdin: $!");
} else {
$pid = open3_setpgrp(::gensym(),$stdout_fh,$stderr_fh,$command);
}
@ -9498,13 +9475,13 @@ sub get {
# To fix: parallel --bar echo {%} ::: a b c ::: d e f
my $ret = shift @{$self->{'unget'}};
if($ret) {
map { $_->flush_cache() } map { @$_ } $ret;
map { $_->flush_cache() } @$ret;
}
return $ret;
}
my $ret = $self->{'arg_sub_queue'}->get();
if($ret and
grep { index($_->orig(),"\0") > 0 } map { @$_ } $ret) {
grep { index($_->orig(),"\0") > 0 } @$ret) {
# Allow for \0 in position 0 because GNU Parallel uses "\0"
# to mean no-string
::warning("a NUL character occurred in the input.",
@ -9520,7 +9497,7 @@ sub get {
# Flush cached computed replacements in Arg-objects
# To fix: parallel --bar echo {%} ::: a b c ::: d e f
if($ret) {
map { $_->flush_cache() } map { @$_ } $ret;
map { $_->flush_cache() } @$ret;
}
return $ret;
}

View file

@ -313,8 +313,6 @@ The following are equivalent:
To avoid treating B<:::> as special use B<--arg-sep> to set the
argument separator to something else. See also B<--arg-sep>.
stdin (standard input) will be passed to the first process run.
If multiple B<:::> are given, each group will be treated as an input
source, and all combinations of input sources will be
generated. E.g. ::: 1 2 ::: a b c will result in the combinations
@ -1006,9 +1004,9 @@ limiting factor.
See also: B<--group> B<--ungroup>
=item B<--xapply> (beta testing)
=item B<--xapply>
=item B<--link> beta testing)
=item B<--link>
Link input sources. Read multiple input sources like B<xapply>. If
multiple input sources are given, one argument will be read from each
@ -2107,7 +2105,7 @@ Use B<tmux> for output. Start a B<tmux> session and run each job in a
window in that session. No other output will be produced.
=item B<--tmuxpane> (beta testing)
=item B<--tmuxpane>
Use B<tmux> for output but put output into panes in the first window.
Useful if you want to monitor the progress of less than 100 concurrent
@ -3311,6 +3309,8 @@ If not all hosts are accessible through TOR:
parallel -S 'torsocks ssh izjafdceobowklhz.onion,host2,host3' echo ::: a b c
See more B<ssh> tricks on https://en.wikibooks.org/wiki/OpenSSH/Cookbook/Proxies_and_Jump_Hosts
=head1 EXAMPLE: Parallelizing rsync