Fixed bug #44143: csh and nice.

This commit is contained in:
Ole Tange 2015-03-08 01:10:24 +01:00
parent 26a94004c9
commit 0b99f96151
3 changed files with 27 additions and 5 deletions

View file

@ -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.

View file

@ -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

View file

@ -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