diff --git a/src/parallel b/src/parallel index a53896a8..067dea9b 100755 --- a/src/parallel +++ b/src/parallel @@ -5953,9 +5953,19 @@ sub wrapped { # Prepend \nice -n19 $SHELL -c # and quote. # The '\' before nice is needed to avoid tcsh's built-in - $command = '\nice'. " -n". $opt::nice. " ". - $Global::shell. " -c ". - ::shell_quote_scalar($command); + my $sshlogin = $self->sshlogin(); + my $serverlogin = $sshlogin->serverlogin(); + if($serverlogin eq ":") { + # Local use $Global::shell + $command = '\nice'. " -n". $opt::nice. " ". + $Global::shell. " -c ". + ::shell_quote_scalar($command); + } else { + # Remote systems use $SHELL + $command = '\nice'. " -n". $opt::nice. + ' $SHELL -c '. + ::shell_quote_scalar($command); + } } if($opt::cat) { # Prepend 'cat > {};' @@ -5981,7 +5991,12 @@ sub wrapped { $command = $self->sshlogin_wrap($command); if(@Global::cat_partials) { # Prepend: - # < /tmp/foo perl -e 'while(@ARGV) { sysseek(STDIN,shift,0) || die; $left = shift; while($read = sysread(STDIN,$buf, ($left > 32768 ? 32768 : $left))){ $left -= $read; syswrite(STDOUT,$buf); } }' 0 0 0 11 | + # < /tmp/foo perl -e 'while(@ARGV) { + # sysseek(STDIN,shift,0) || die; $left = shift; + # while($read = sysread(STDIN,$buf, ($left > 32768 ? 32768 : $left))){ + # $left -= $read; syswrite(STDOUT,$buf); + # } + # }' 0 0 0 11 | $command = (shift @Global::cat_partials). " | ($command)"; } elsif($opt::pipe) { # Prepend EOF-detector to avoid starting $command if EOF. diff --git a/testsuite/tests-to-run/parallel-local-ssh4.sh b/testsuite/tests-to-run/parallel-local-ssh4.sh index f86adc75..b14afdc0 100644 --- a/testsuite/tests-to-run/parallel-local-ssh4.sh +++ b/testsuite/tests-to-run/parallel-local-ssh4.sh @@ -1,7 +1,7 @@ #!/bin/bash # SSH only allowed to localhost/lo -cat <<'EOF' | sed -e s/\$SERVER1/$SERVER1/\;s/\$SERVER2/$SERVER2/ | parallel -vj8 -k --joblog /tmp/jl-`basename $0` -L1 +cat <<'EOF' | sed -e s/\$SERVER1/$SERVER1/\;s/\$SERVER2/$SERVER2/ | parallel -vj7 -k --joblog /tmp/jl-`basename $0` -L1 echo '### zsh' ssh zsh@lo 'fun="() { echo function from zsh to zsh \$*; }"; export fun; @@ -60,4 +60,7 @@ echo '### bug #44371: --trc with csh complains' cat file1.a file2.b; rm /tmp/file1 /tmp/file2 /tmp/file1.a /tmp/file2.b +echo '### bug #44143: csh and nice' + parallel --nice 1 -S csh@lo setenv B {}\; echo '$B' ::: OK + EOF diff --git a/testsuite/wanted-results/parallel-local-ssh4 b/testsuite/wanted-results/parallel-local-ssh4 index 72e5221a..d05f23cf 100644 --- a/testsuite/wanted-results/parallel-local-ssh4 +++ b/testsuite/wanted-results/parallel-local-ssh4 @@ -65,3 +65,7 @@ echo '### bug #44371: --trc with csh complains' cd /tmp; echo 1 > file1; echo 2 > file2; parallel -Scsh@lo --trc {1}.a --trc {2}.b 'echo A {1} > {1}.a; echo B {2} > {2}.b' ::: file1 ::: file2; cat file1.a file2.b; rm /tmp/file1 /tmp/file2 /tmp/file1.a /tmp/file2.b A file1 B file2 +echo '### bug #44143: csh and nice' +### bug #44143: csh and nice + parallel --nice 1 -S csh@lo setenv B {}\; echo '$B' ::: OK +OK