From 986f69db11760aef920fa167ae9f352b7314b609 Mon Sep 17 00:00:00 2001 From: Ole Tange Date: Sat, 24 Sep 2011 02:35:16 +0200 Subject: [PATCH] parallel: fixed bug #33995: Jobs executed with sh instead of $SHELL --- src/parallel | 8 ++++---- testsuite/tests-to-run/test20.sh | 3 +++ testsuite/wanted-results/test20 | 3 +++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/parallel b/src/parallel index bea103e1..9693f507 100755 --- a/src/parallel +++ b/src/parallel @@ -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); diff --git a/testsuite/tests-to-run/test20.sh b/testsuite/tests-to-run/test20.sh index d53e92ac..7d477031 100644 --- a/testsuite/tests-to-run/test20.sh +++ b/testsuite/tests-to-run/test20.sh @@ -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 diff --git a/testsuite/wanted-results/test20 b/testsuite/wanted-results/test20 index b5bfdfde..f64b73c5 100644 --- a/testsuite/wanted-results/test20 +++ b/testsuite/wanted-results/test20 @@ -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