parallel: fixed bug #33995: Jobs executed with sh instead of $SHELL

This commit is contained in:
Ole Tange 2011-09-24 02:35:16 +02:00
parent 9fad573774
commit 986f69db11
3 changed files with 10 additions and 4 deletions

View file

@ -3361,13 +3361,13 @@ sub start {
. $job->seq() . "): $command\n");
if($::opt_pipe) {
my ($in);
$pid = ::open3($in, ">&OUT", ">&ERR", $command) ||
$pid = ::open3($in, ">&OUT", ">&ERR", $ENV{SHELL}, "-c", $command) ||
::die_bug("open3-pipe");
$job->set_stdin($in);
} elsif(@::opt_a and not $Global::stdin_in_opt_a and $job->seq() == 1) {
# Give STDIN to the first job if using -a
*IN = *STDIN;
$pid = ::open3("<&IN", ">&OUT", ">&ERR", $command) ||
$pid = ::open3("<&IN", ">&OUT", ">&ERR", $ENV{SHELL}, "-c", $command) ||
::die_bug("open3-a");
# Re-open to avoid complaining
open STDIN, "<&", $Global::original_stdin
@ -3376,12 +3376,12 @@ sub start {
open(DEVTTY, "/dev/tty")) {
# Give /dev/tty to the command if no one else is using it
*IN = *DEVTTY;
$pid = ::open3("<&IN", ">&OUT", ">&ERR", $command) ||
$pid = ::open3("<&IN", ">&OUT", ">&ERR", $ENV{SHELL}, "-c", $command) ||
::die_bug("open3-/dev/tty");
$Global::tty_taken = $pid;
close DEVTTY;
} else {
$pid = ::open3(::gensym, ">&OUT", ">&ERR", $command) ||
$pid = ::open3(::gensym, ">&OUT", ">&ERR", $ENV{SHELL}, "-c", $command) ||
::die_bug("open3-gensym");
}
$job->set_pid($pid);

View file

@ -20,3 +20,6 @@ stdout parallel -k --tag -j1 echo stderr-{.} ">&2;" echo stdout-{} ::: a b
echo '### Test --tag -X ::: a b'
stdout parallel -k --tag -X -j1 echo stderr-{.} ">&2;" echo stdout-{} ::: a b
echo '### Test bash redirection <()'
parallel 'cat <(echo {}); echo b' ::: a

View file

@ -17,3 +17,6 @@ b stdout-b
### Test --tag -X ::: a b
a b stderr-a stderr-b
a b stdout-a stdout-b
### Test bash redirection <()
a
b