mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-12-24 21:57:55 +00:00
sem: --fg exit code = exit code from command.
This commit is contained in:
parent
be43ddb832
commit
3461b32dea
|
@ -72,7 +72,7 @@ run() {
|
|||
if gpg --list-keys 0xFFFFFFF1 && gpg --list-keys 0x88888888 ; then
|
||||
echo Keys fetched
|
||||
# OK
|
||||
return 0
|
||||
return 0
|
||||
else
|
||||
keyservers="keyserver.ubuntu.com
|
||||
pgp.surf.nl
|
||||
|
@ -86,14 +86,14 @@ run() {
|
|||
return 0
|
||||
fi
|
||||
done
|
||||
echo
|
||||
echo "Cannot fetch keyID 0x88888888, so the signature cannot be checked."
|
||||
echo
|
||||
echo "Cannot fetch keyID 0x88888888, so the signature cannot be checked."
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
# GnuPG not installed
|
||||
# GnuPG not installed
|
||||
echo
|
||||
echo "GnuPG (gpg) is not installed so the signature cannot be checked."
|
||||
echo "GnuPG (gpg) is not installed so the signature cannot be checked."
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ run() {
|
|||
# GnuPG signature failed
|
||||
echo
|
||||
echo "The signature on $latest.tar.bz2 is wrong. This may indicate that a criminal has changed the code."
|
||||
echo "THIS IS BAD AND THE CODE WILL NOT BE INSTALLED."
|
||||
echo "THIS IS BAD AND THE CODE WILL NOT BE INSTALLED."
|
||||
echo
|
||||
echo "See http://git.savannah.gnu.org/cgit/parallel.git/tree/README for other installation methods."
|
||||
exit 1
|
||||
|
@ -121,7 +121,7 @@ run() {
|
|||
echo "Continue anyway? (y/n)"
|
||||
read YN </dev/tty
|
||||
if test "$YN" = "n"; then
|
||||
# Stop
|
||||
# Stop
|
||||
exit 2
|
||||
else
|
||||
# Continue
|
||||
|
@ -152,7 +152,7 @@ run() {
|
|||
true
|
||||
else
|
||||
# Add $HOME/bin to $PATH for both bash and csh
|
||||
echo 'PATH=$PATH:$HOME/bin' >> "$HOME"/.bashrc
|
||||
echo 'PATH=$PATH:$HOME/bin' >> "$HOME"/.bashrc
|
||||
echo 'setenv PATH ${PATH}:${HOME}/bin' >> "$HOME"/.cshrc
|
||||
fi
|
||||
|
||||
|
|
26
src/parallel
26
src/parallel
|
@ -115,7 +115,16 @@ sub halt() {
|
|||
}
|
||||
wait_and_exit($Global::halt_exitstatus);
|
||||
} else {
|
||||
wait_and_exit(min(undef_as_zero($Global::exitstatus),101));
|
||||
if($Global::semaphore) {
|
||||
# --semaphore runs a single job:
|
||||
# Use exit value of that
|
||||
wait_and_exit($Global::halt_exitstatus);
|
||||
} else {
|
||||
# 0 = all jobs succeeded
|
||||
# 1-100 = n jobs failed
|
||||
# 101 = >100 jobs failed
|
||||
wait_and_exit(min(undef_as_zero($Global::exitstatus),101));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2296,7 +2305,7 @@ sub check_invalid_option_combinations() {
|
|||
|
||||
sub init_globals() {
|
||||
# Defaults:
|
||||
$Global::version = 20220122;
|
||||
$Global::version = 20220202;
|
||||
$Global::progname = 'parallel';
|
||||
$::name = "GNU Parallel";
|
||||
$Global::infinity = 2**31;
|
||||
|
@ -9978,7 +9987,7 @@ sub start($) {
|
|||
eval{ setpgrp(0,0) };
|
||||
eval{ setpriority(0,0,$opt::nice) };
|
||||
exec($Global::shell,"-c",$command)
|
||||
|| ::die_bug("open3-$stdin_fh $command");
|
||||
|| ::die_bug("open3-$stdin_fh ".substr($command,0,200));
|
||||
}
|
||||
};
|
||||
return $pid;
|
||||
|
@ -10134,7 +10143,7 @@ sub start($) {
|
|||
};
|
||||
close $devtty_fh;
|
||||
$job->set_virgin(0);
|
||||
} elsif($opt::semaphore) {
|
||||
} elsif($Global::semaphore) {
|
||||
# Allow sem to read from stdin
|
||||
$pid = open3_setpgrp("<&STDIN",$stdout_fh,$stderr_fh,$command);
|
||||
$job->set_virgin(0);
|
||||
|
@ -11081,6 +11090,13 @@ sub set_exitsignal($$) {
|
|||
# Returns: N/A
|
||||
my $job = shift;
|
||||
my $limit;
|
||||
if($Global::semaphore) {
|
||||
# Emulate Bash's +128 if there is a signal
|
||||
$Global::halt_exitstatus =
|
||||
($job->exitstatus()
|
||||
or
|
||||
$job->exitsignal() ? $job->exitsignal() + 128 : 0);
|
||||
}
|
||||
if($job->exitstatus() or $job->exitsignal()) {
|
||||
# Job failed
|
||||
$Global::exitstatus++;
|
||||
|
@ -12412,7 +12428,7 @@ sub tmux_length($) {
|
|||
::debug("tmux","tmux-out ",@out);
|
||||
chomp @out;
|
||||
# The arguments is given 3 times on the command line
|
||||
# and the wrapping is around 30 chars
|
||||
# and the tmux wrapping is around 30 chars
|
||||
# (29 for tmux1.9, 33 for tmux1.8)
|
||||
my $tmux_len = ::max(@out);
|
||||
$len = ::min($len,int($tmux_len/4-33));
|
||||
|
|
684
src/parallel.pod
684
src/parallel.pod
File diff suppressed because it is too large
Load diff
|
@ -63,6 +63,28 @@ par_semaphore-timeout() {
|
|||
stdout sem --id st --wait
|
||||
}
|
||||
|
||||
par_exit() {
|
||||
echo '### Exit values'
|
||||
test_exit() {
|
||||
stdout sem --fg --id exit$1 exit $1
|
||||
echo $?
|
||||
}
|
||||
export -f test_exit
|
||||
parallel --tag -k test_exit ::: 0 1 10 100 101 102 222 255
|
||||
|
||||
echo '### Exit values - signal'
|
||||
test_signal() {
|
||||
bash -c 'kill -'$1' $$'
|
||||
echo Bash exit value $?
|
||||
stdout sem --fg --id signal$1 kill -$1 '$$'
|
||||
echo Sem exit value $?
|
||||
}
|
||||
export -f test_signal
|
||||
stdout parallel -k --timeout 3 --tag test_signal ::: {0..64} |
|
||||
perl -pe 's/line 1: (\d+)/line 1: PID/'
|
||||
}
|
||||
|
||||
|
||||
export -f $(compgen -A function | grep par_)
|
||||
compgen -A function | grep par_ | LC_ALL=C sort |
|
||||
parallel --timeout 3000% -j6 --tag -k --joblog /tmp/jl-`basename $0` '{} 2>&1' |
|
||||
|
|
|
@ -17,6 +17,198 @@ par_2jobs done 3
|
|||
par_2jobs done 4
|
||||
par_bg_p_should_error ### Test bug #33621: --bg -p should give an error message
|
||||
par_bg_p_should_error parallel: Error: Jobs running in the background cannot be interactive.
|
||||
par_exit ### Exit values
|
||||
par_exit 0 0
|
||||
par_exit 1 1
|
||||
par_exit 10 10
|
||||
par_exit 100 100
|
||||
par_exit 101 101
|
||||
par_exit 102 102
|
||||
par_exit 222 222
|
||||
par_exit 255 255
|
||||
par_exit ### Exit values - signal
|
||||
par_exit 0 Bash exit value 0
|
||||
par_exit 0 Sem exit value 0
|
||||
par_exit 1 Bash exit value 129
|
||||
par_exit 1 Sem exit value 129
|
||||
par_exit 1 environment: line 1: PID Hangup bash -c 'kill -'$1' $$'
|
||||
par_exit 2 Bash exit value 130
|
||||
par_exit 2 Sem exit value 130
|
||||
par_exit 3 Bash exit value 0
|
||||
par_exit 3 Sem exit value 0
|
||||
par_exit 4 Bash exit value 132
|
||||
par_exit 4 Sem exit value 132
|
||||
par_exit 4 environment: line 1: PID Illegal instruction (core dumped) bash -c 'kill -'$1' $$'
|
||||
par_exit 5 Bash exit value 133
|
||||
par_exit 5 Sem exit value 133
|
||||
par_exit 5 environment: line 1: PID Trace/breakpoint trap (core dumped) bash -c 'kill -'$1' $$'
|
||||
par_exit 6 Bash exit value 134
|
||||
par_exit 6 Sem exit value 134
|
||||
par_exit 6 environment: line 1: PID Aborted (core dumped) bash -c 'kill -'$1' $$'
|
||||
par_exit 7 Bash exit value 135
|
||||
par_exit 7 Sem exit value 135
|
||||
par_exit 7 environment: line 1: PID Bus error (core dumped) bash -c 'kill -'$1' $$'
|
||||
par_exit 8 Bash exit value 136
|
||||
par_exit 8 Sem exit value 136
|
||||
par_exit 8 environment: line 1: PID Floating point exception(core dumped) bash -c 'kill -'$1' $$'
|
||||
par_exit 9 Bash exit value 137
|
||||
par_exit 9 Sem exit value 137
|
||||
par_exit 9 environment: line 1: PID Killed bash -c 'kill -'$1' $$'
|
||||
par_exit 10 Bash exit value 138
|
||||
par_exit 10 Sem exit value 138
|
||||
par_exit 10 environment: line 1: PID User defined signal 1 bash -c 'kill -'$1' $$'
|
||||
par_exit 11 Bash exit value 139
|
||||
par_exit 11 Sem exit value 139
|
||||
par_exit 11 environment: line 1: PID Segmentation fault (core dumped) bash -c 'kill -'$1' $$'
|
||||
par_exit 12 Bash exit value 140
|
||||
par_exit 12 Sem exit value 140
|
||||
par_exit 12 environment: line 1: PID User defined signal 2 bash -c 'kill -'$1' $$'
|
||||
par_exit 13 Bash exit value 141
|
||||
par_exit 13 Sem exit value 141
|
||||
par_exit 14 Bash exit value 0
|
||||
par_exit 14 Sem exit value 0
|
||||
par_exit 15 Bash exit value 143
|
||||
par_exit 15 Sem exit value 143
|
||||
par_exit 15 Terminated
|
||||
par_exit 16 Bash exit value 144
|
||||
par_exit 16 Sem exit value 144
|
||||
par_exit 16 environment: line 1: PID Stack fault bash -c 'kill -'$1' $$'
|
||||
par_exit 17 Bash exit value 0
|
||||
par_exit 17 Sem exit value 0
|
||||
par_exit 18 Bash exit value 0
|
||||
par_exit 18 Sem exit value 0
|
||||
par_exit parallel: Warning: This job was killed because it timed out:
|
||||
par_exit parallel: Warning: test_signal 19
|
||||
par_exit parallel: Warning: This job was killed because it timed out:
|
||||
par_exit parallel: Warning: test_signal 20
|
||||
par_exit parallel: Warning: This job was killed because it timed out:
|
||||
par_exit parallel: Warning: test_signal 21
|
||||
par_exit parallel: Warning: This job was killed because it timed out:
|
||||
par_exit parallel: Warning: test_signal 22
|
||||
par_exit 23 Bash exit value 0
|
||||
par_exit 23 Sem exit value 0
|
||||
par_exit 24 Bash exit value 152
|
||||
par_exit 24 Sem exit value 152
|
||||
par_exit 24 environment: line 1: PID CPU time limit exceeded (core dumped) bash -c 'kill -'$1' $$'
|
||||
par_exit 25 Bash exit value 153
|
||||
par_exit 25 Sem exit value 153
|
||||
par_exit 25 environment: line 1: PID File size limit exceeded(core dumped) bash -c 'kill -'$1' $$'
|
||||
par_exit 26 Bash exit value 154
|
||||
par_exit 26 Sem exit value 154
|
||||
par_exit 26 environment: line 1: PID Virtual timer expired bash -c 'kill -'$1' $$'
|
||||
par_exit 27 Bash exit value 155
|
||||
par_exit 27 Sem exit value 155
|
||||
par_exit 27 environment: line 1: PID Profiling timer expired bash -c 'kill -'$1' $$'
|
||||
par_exit 28 Bash exit value 0
|
||||
par_exit 28 Sem exit value 0
|
||||
par_exit 29 Bash exit value 157
|
||||
par_exit 29 Sem exit value 157
|
||||
par_exit 29 environment: line 1: PID I/O possible bash -c 'kill -'$1' $$'
|
||||
par_exit 30 Bash exit value 158
|
||||
par_exit 30 Sem exit value 158
|
||||
par_exit 30 environment: line 1: PID Power failure bash -c 'kill -'$1' $$'
|
||||
par_exit 31 Bash exit value 159
|
||||
par_exit 31 Sem exit value 159
|
||||
par_exit 31 environment: line 1: PID Bad system call (core dumped) bash -c 'kill -'$1' $$'
|
||||
par_exit 32 Bash exit value 160
|
||||
par_exit 32 Sem exit value 160
|
||||
par_exit 32 environment: line 1: PID Unknown signal 32 bash -c 'kill -'$1' $$'
|
||||
par_exit 33 Bash exit value 161
|
||||
par_exit 33 Sem exit value 161
|
||||
par_exit 33 environment: line 1: PID Unknown signal 33 bash -c 'kill -'$1' $$'
|
||||
par_exit 34 Bash exit value 162
|
||||
par_exit 34 Sem exit value 162
|
||||
par_exit 34 environment: line 1: PID Real-time signal 0 bash -c 'kill -'$1' $$'
|
||||
par_exit 35 Bash exit value 163
|
||||
par_exit 35 Sem exit value 163
|
||||
par_exit 35 environment: line 1: PID Real-time signal 1 bash -c 'kill -'$1' $$'
|
||||
par_exit 36 Bash exit value 164
|
||||
par_exit 36 Sem exit value 164
|
||||
par_exit 36 environment: line 1: PID Real-time signal 2 bash -c 'kill -'$1' $$'
|
||||
par_exit 37 Bash exit value 165
|
||||
par_exit 37 Sem exit value 165
|
||||
par_exit 37 environment: line 1: PID Real-time signal 3 bash -c 'kill -'$1' $$'
|
||||
par_exit 38 Bash exit value 166
|
||||
par_exit 38 Sem exit value 166
|
||||
par_exit 38 environment: line 1: PID Real-time signal 4 bash -c 'kill -'$1' $$'
|
||||
par_exit 39 Bash exit value 167
|
||||
par_exit 39 Sem exit value 167
|
||||
par_exit 39 environment: line 1: PID Real-time signal 5 bash -c 'kill -'$1' $$'
|
||||
par_exit 40 Bash exit value 168
|
||||
par_exit 40 Sem exit value 168
|
||||
par_exit 40 environment: line 1: PID Real-time signal 6 bash -c 'kill -'$1' $$'
|
||||
par_exit 41 Bash exit value 169
|
||||
par_exit 41 Sem exit value 169
|
||||
par_exit 41 environment: line 1: PID Real-time signal 7 bash -c 'kill -'$1' $$'
|
||||
par_exit 42 Bash exit value 170
|
||||
par_exit 42 Sem exit value 170
|
||||
par_exit 42 environment: line 1: PID Real-time signal 8 bash -c 'kill -'$1' $$'
|
||||
par_exit 43 Bash exit value 171
|
||||
par_exit 43 Sem exit value 171
|
||||
par_exit 43 environment: line 1: PID Real-time signal 9 bash -c 'kill -'$1' $$'
|
||||
par_exit 44 Bash exit value 172
|
||||
par_exit 44 Sem exit value 172
|
||||
par_exit 44 environment: line 1: PID Real-time signal 10 bash -c 'kill -'$1' $$'
|
||||
par_exit 45 Bash exit value 173
|
||||
par_exit 45 Sem exit value 173
|
||||
par_exit 45 environment: line 1: PID Real-time signal 11 bash -c 'kill -'$1' $$'
|
||||
par_exit 46 Bash exit value 174
|
||||
par_exit 46 Sem exit value 174
|
||||
par_exit 46 environment: line 1: PID Real-time signal 12 bash -c 'kill -'$1' $$'
|
||||
par_exit 47 Bash exit value 175
|
||||
par_exit 47 Sem exit value 175
|
||||
par_exit 47 environment: line 1: PID Real-time signal 13 bash -c 'kill -'$1' $$'
|
||||
par_exit 48 Bash exit value 176
|
||||
par_exit 48 Sem exit value 176
|
||||
par_exit 48 environment: line 1: PID Real-time signal 14 bash -c 'kill -'$1' $$'
|
||||
par_exit 49 Bash exit value 177
|
||||
par_exit 49 Sem exit value 177
|
||||
par_exit 49 environment: line 1: PID Real-time signal 15 bash -c 'kill -'$1' $$'
|
||||
par_exit 50 Bash exit value 178
|
||||
par_exit 50 Sem exit value 178
|
||||
par_exit 50 environment: line 1: PID Real-time signal 16 bash -c 'kill -'$1' $$'
|
||||
par_exit 51 Bash exit value 179
|
||||
par_exit 51 Sem exit value 179
|
||||
par_exit 51 environment: line 1: PID Real-time signal 17 bash -c 'kill -'$1' $$'
|
||||
par_exit 52 Bash exit value 180
|
||||
par_exit 52 Sem exit value 180
|
||||
par_exit 52 environment: line 1: PID Real-time signal 18 bash -c 'kill -'$1' $$'
|
||||
par_exit 53 Bash exit value 181
|
||||
par_exit 53 Sem exit value 181
|
||||
par_exit 53 environment: line 1: PID Real-time signal 19 bash -c 'kill -'$1' $$'
|
||||
par_exit 54 Bash exit value 182
|
||||
par_exit 54 Sem exit value 182
|
||||
par_exit 54 environment: line 1: PID Real-time signal 20 bash -c 'kill -'$1' $$'
|
||||
par_exit 55 Bash exit value 183
|
||||
par_exit 55 Sem exit value 183
|
||||
par_exit 55 environment: line 1: PID Real-time signal 21 bash -c 'kill -'$1' $$'
|
||||
par_exit 56 Bash exit value 184
|
||||
par_exit 56 Sem exit value 184
|
||||
par_exit 56 environment: line 1: PID Real-time signal 22 bash -c 'kill -'$1' $$'
|
||||
par_exit 57 Bash exit value 185
|
||||
par_exit 57 Sem exit value 185
|
||||
par_exit 57 environment: line 1: PID Real-time signal 23 bash -c 'kill -'$1' $$'
|
||||
par_exit 58 Bash exit value 186
|
||||
par_exit 58 Sem exit value 186
|
||||
par_exit 58 environment: line 1: PID Real-time signal 24 bash -c 'kill -'$1' $$'
|
||||
par_exit 59 Bash exit value 187
|
||||
par_exit 59 Sem exit value 187
|
||||
par_exit 59 environment: line 1: PID Real-time signal 25 bash -c 'kill -'$1' $$'
|
||||
par_exit 60 Bash exit value 188
|
||||
par_exit 60 Sem exit value 188
|
||||
par_exit 60 environment: line 1: PID Real-time signal 26 bash -c 'kill -'$1' $$'
|
||||
par_exit 61 Bash exit value 189
|
||||
par_exit 61 Sem exit value 189
|
||||
par_exit 61 environment: line 1: PID Real-time signal 27 bash -c 'kill -'$1' $$'
|
||||
par_exit 62 Bash exit value 190
|
||||
par_exit 62 Sem exit value 190
|
||||
par_exit 62 environment: line 1: PID Real-time signal 28 bash -c 'kill -'$1' $$'
|
||||
par_exit 63 Bash exit value 191
|
||||
par_exit 63 Sem exit value 191
|
||||
par_exit 63 environment: line 1: PID Real-time signal 29 bash -c 'kill -'$1' $$'
|
||||
par_exit 64 Bash exit value 192
|
||||
par_exit 64 Sem exit value 192
|
||||
par_exit 64 environment: line 1: PID Real-time signal 30 bash -c 'kill -'$1' $$'
|
||||
par_fg_line-buffer ### Failed on 20141226
|
||||
par_fg_line-buffer OK
|
||||
par_fg_then_bg ### Test --fg followed by --bg
|
||||
|
|
Loading…
Reference in a new issue