mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-11-26 07:57:58 +00:00
parallel: --nonall was incompatible with --joblog and --files. Fixed.
This commit is contained in:
parent
378ecf6831
commit
06597f9395
|
@ -367,6 +367,7 @@ sub start {
|
||||||
}
|
}
|
||||||
|
|
||||||
use POSIX ":sys_wait_h";
|
use POSIX ":sys_wait_h";
|
||||||
|
use POSIX qw(:sys_wait_h);
|
||||||
|
|
||||||
sub REAPER {
|
sub REAPER {
|
||||||
my $stiff;
|
my $stiff;
|
||||||
|
|
29
src/parallel
29
src/parallel
|
@ -207,6 +207,15 @@ if($opt::filter_hosts and (@opt::sshlogin or @opt::sshloginfile)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if($opt::nonall or $opt::onall) {
|
if($opt::nonall or $opt::onall) {
|
||||||
|
sub tmp_joblog {
|
||||||
|
my $joblog = shift;
|
||||||
|
if(not defined $joblog) {
|
||||||
|
return undef;
|
||||||
|
}
|
||||||
|
my ($fh, $tmpfile) = ::tempfile(SUFFIX => ".log");
|
||||||
|
close $fh;
|
||||||
|
return $tmpfile;
|
||||||
|
}
|
||||||
# Copy all @fhlist into tempfiles
|
# Copy all @fhlist into tempfiles
|
||||||
my @argfiles = ();
|
my @argfiles = ();
|
||||||
for my $fh (@fhlist) {
|
for my $fh (@fhlist) {
|
||||||
|
@ -234,7 +243,7 @@ if($opt::nonall or $opt::onall) {
|
||||||
join(" ",
|
join(" ",
|
||||||
((defined $opt::u) ? "-u" : ""),
|
((defined $opt::u) ? "-u" : ""),
|
||||||
((defined $opt::group) ? "-g" : ""),
|
((defined $opt::group) ? "-g" : ""),
|
||||||
((defined $opt::joblog) ? "--joblog $opt::joblog" : ""),
|
((defined $opt::files) ? "--files" : ""),
|
||||||
((defined $opt::colsep) ? "--colsep ".shell_quote($opt::colsep) : ""),
|
((defined $opt::colsep) ? "--colsep ".shell_quote($opt::colsep) : ""),
|
||||||
((@opt::v) ? "-vv" : ""),
|
((@opt::v) ? "-vv" : ""),
|
||||||
((defined $opt::D) ? "-D" : ""),
|
((defined $opt::D) ? "-D" : ""),
|
||||||
|
@ -247,8 +256,14 @@ if($opt::nonall or $opt::onall) {
|
||||||
::debug("| $0 $options\n");
|
::debug("| $0 $options\n");
|
||||||
open(my $parallel_fh, "|-", "$0 -j0 $options") ||
|
open(my $parallel_fh, "|-", "$0 -j0 $options") ||
|
||||||
::die_bug("This does not run GNU Parallel: $0 $options");
|
::die_bug("This does not run GNU Parallel: $0 $options");
|
||||||
|
my @joblogs;
|
||||||
for my $sshlogin (values %Global::host) {
|
for my $sshlogin (values %Global::host) {
|
||||||
print $parallel_fh "$0 $suboptions -j1 ".
|
my $joblog = tmp_joblog($opt::joblog);
|
||||||
|
if($joblog) {
|
||||||
|
push @joblogs, $joblog;
|
||||||
|
$joblog = "--joblog $joblog";
|
||||||
|
}
|
||||||
|
print $parallel_fh "$0 $suboptions -j1 $joblog ".
|
||||||
((defined $opt::tag) ?
|
((defined $opt::tag) ?
|
||||||
"--tagstring ".shell_quote_scalar($sshlogin->string()) : "").
|
"--tagstring ".shell_quote_scalar($sshlogin->string()) : "").
|
||||||
" -S ". shell_quote_scalar($sshlogin->string())." ".
|
" -S ". shell_quote_scalar($sshlogin->string())." ".
|
||||||
|
@ -259,6 +274,16 @@ if($opt::nonall or $opt::onall) {
|
||||||
debug("--onall exitvalue ",$?);
|
debug("--onall exitvalue ",$?);
|
||||||
if(@opt::basefile) { cleanup_basefile(); }
|
if(@opt::basefile) { cleanup_basefile(); }
|
||||||
unlink(@argfiles);
|
unlink(@argfiles);
|
||||||
|
my %seen;
|
||||||
|
for my $joblog (@joblogs) {
|
||||||
|
# Append to $joblog
|
||||||
|
open(my $fh, "<", $joblog) || ::die_bug("Cannot open tmp joblog $joblog");
|
||||||
|
# Skip first line (header);
|
||||||
|
<$fh>;
|
||||||
|
print $Global::joblog (<$fh>);
|
||||||
|
close $fh;
|
||||||
|
unlink($joblog);
|
||||||
|
}
|
||||||
wait_and_exit(min(undef_as_zero($Global::exitstatus),254));
|
wait_and_exit(min(undef_as_zero($Global::exitstatus),254));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue