parallel: Fixed bug #36352: --timeout not working on Solaris.

This commit is contained in:
Ole Tange 2012-06-03 22:51:22 +02:00
parent 1a98839ca4
commit f2ca6436c6

View file

@ -3198,7 +3198,9 @@ 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;
if ($^O eq 'linux') {
$script = q{
family_pids() { family_pids() {
for CHILDPID in `ps --ppid "$@" -o pid --no-headers`; do for CHILDPID in `ps --ppid "$@" -o pid --no-headers`; do
family_pids $CHILDPID & family_pids $CHILDPID &
@ -3207,12 +3209,34 @@ sub family_pids {
} }
} . } .
"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;