From a36729cdf39f06d0aa1464bf0c1cd3be8fddba27 Mon Sep 17 00:00:00 2001 From: Ole Tange Date: Sat, 22 Oct 2016 13:39:31 +0200 Subject: [PATCH] Fixed bug #49229: parallel hangs on last ffmpeg command. First command no longer gets stdin as it causes unpredictable issues. --- src/parallel | 29 +++-------------------------- src/parallel.pod | 10 +++++----- 2 files changed, 8 insertions(+), 31 deletions(-) diff --git a/src/parallel b/src/parallel index 1a8afab4..03ac6f09 100755 --- a/src/parallel +++ b/src/parallel @@ -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-{'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; } diff --git a/src/parallel.pod b/src/parallel.pod index c852334b..80d14c31 100644 --- a/src/parallel.pod +++ b/src/parallel.pod @@ -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. If multiple input sources are given, one argument will be read from each @@ -2107,7 +2105,7 @@ Use B for output. Start a B 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 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 tricks on https://en.wikibooks.org/wiki/OpenSSH/Cookbook/Proxies_and_Jump_Hosts + =head1 EXAMPLE: Parallelizing rsync