parallel: fixed --interactive.

parallel: fixed --basefile with --workdir.
This commit is contained in:
Ole Tange 2016-05-09 00:03:11 +02:00
parent 9d9016b88f
commit 17a50e3354

View file

@ -2928,7 +2928,11 @@ sub setup_basefile {
::error("Work dir '...' will not work with relative basefiles."); ::error("Work dir '...' will not work with relative basefiles.");
::wait_and_exit(255); ::wait_and_exit(255);
} }
$workdir ||= Job->new("")->workdir(); if(not $workdir) {
my $dummycmdline = CommandLine->new(1,"true",0,0,0,0,0,{},{},{});
my $dummyjob = Job->new($dummycmdline);
$workdir = $dummyjob->workdir();
}
$cmd .= $sshlogin->rsync_transfer_cmd($file,$workdir) . "&"; $cmd .= $sshlogin->rsync_transfer_cmd($file,$workdir) . "&";
} }
} }
@ -2944,7 +2948,12 @@ sub cleanup_basefile {
# @opt::basefile # @opt::basefile
# Returns: N/A # Returns: N/A
my $cmd = ""; my $cmd = "";
my $workdir = Job->new("")->workdir(); my $workdir;
if(not $workdir) {
my $dummycmdline = CommandLine->new(1,"true",0,0,0,0,0,{},{},{});
my $dummyjob = Job->new($dummycmdline);
$workdir = $dummyjob->workdir();
}
for my $sshlogin (values %Global::host) { for my $sshlogin (values %Global::host) {
if($sshlogin->string() eq ":") { next } if($sshlogin->string() eq ":") { next }
for my $file (@opt::basefile) { for my $file (@opt::basefile) {
@ -7532,13 +7541,15 @@ sub start {
my $command = $job->wrapped(); my $command = $job->wrapped();
my $pid; my $pid;
if($Global::interactive or $Global::stderr_verbose) {
$job->interactive_start();
}
# Must be run after $job->interactive_start():
# $job->interactive_start() may call $job->skip()
if($job->{'commandline'}{'skip'}) { if($job->{'commandline'}{'skip'}) {
# $job->skip() was called # $job->skip() was called
$command = "true"; $command = "true";
} }
if($Global::interactive or $Global::stderr_verbose) {
$job->interactive_start();
}
$job->openoutputfiles(); $job->openoutputfiles();
my($stdout_fh,$stderr_fh) = ($job->fh(1,"w"),$job->fh(2,"w")); my($stdout_fh,$stderr_fh) = ($job->fh(1,"w"),$job->fh(2,"w"));
if($opt::ungroup or $opt::sqlworker) { if($opt::ungroup or $opt::sqlworker) {