mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-12-23 05:07:54 +00:00
parallel: Fixed bug #36352: --timeout not working on Solaris.
This commit is contained in:
parent
1a98839ca4
commit
f2ca6436c6
42
src/parallel
42
src/parallel
|
@ -3198,21 +3198,45 @@ sub family_pids {
|
||||||
# TODO test this on different OS as 'ps' is known to be different
|
# TODO test this on different OS as 'ps' is known to be different
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $pid = $self->pid();
|
my $pid = $self->pid();
|
||||||
my $script = q{
|
my $script;
|
||||||
family_pids() {
|
if ($^O eq 'linux') {
|
||||||
for CHILDPID in `ps --ppid "$@" -o pid --no-headers`; do
|
$script = q{
|
||||||
|
family_pids() {
|
||||||
|
for CHILDPID in `ps --ppid "$@" -o pid --no-headers`; do
|
||||||
family_pids $CHILDPID &
|
family_pids $CHILDPID &
|
||||||
done
|
done
|
||||||
echo "$@"
|
echo "$@"
|
||||||
}
|
}
|
||||||
} .
|
} .
|
||||||
"family_pids $pid; wait";
|
"family_pids $pid; wait";
|
||||||
|
} elsif ($^O eq 'solaris') {
|
||||||
|
$script = q{
|
||||||
|
family_pids() {
|
||||||
|
if [ -z "$1" ] ; then return ; fi
|
||||||
|
family_pids `pgrep -P "$*"` &
|
||||||
|
for CHILDPID in "$@"; do
|
||||||
|
echo $CHILDPID
|
||||||
|
done
|
||||||
|
}
|
||||||
|
} .
|
||||||
|
"family_pids $pid; wait";
|
||||||
|
} else {
|
||||||
|
# This should cover all System V-derived flavors of 'ps'
|
||||||
|
$script = q{
|
||||||
|
family_pids() {
|
||||||
|
for CHILDPID in `ps -f | awk '$3 == '"$@"' {print $2}'`; do
|
||||||
|
family_pids $CHILDPID &
|
||||||
|
done
|
||||||
|
echo "$@"
|
||||||
|
}
|
||||||
|
} .
|
||||||
|
"family_pids $pid; wait";
|
||||||
|
}
|
||||||
my @pids = qx{$script};
|
my @pids = qx{$script};
|
||||||
chomp(@pids);
|
chomp(@pids);
|
||||||
return ($pid,@pids);
|
return (@pids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
sub failed {
|
sub failed {
|
||||||
# return number of times failed for this $sshlogin
|
# return number of times failed for this $sshlogin
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
|
Loading…
Reference in a new issue