summaryrefslogtreecommitdiff
path: root/ACE
diff options
context:
space:
mode:
authorJeff Schmitz <schmitzj@ociweb.com>2015-11-09 13:21:57 -0600
committerAdam Mitz <mitza@ociweb.com>2015-11-09 13:21:57 -0600
commit05e86a3125024bc134ebeb774b92046a6710abeb (patch)
tree440a4c18bd122648950b67e6d5a9161ae015b45d /ACE
parent6008d58edcaffd00ea595b2bfa30d0c5bb618d66 (diff)
downloadATCD-05e86a3125024bc134ebeb774b92046a6710abeb.tar.gz
Process_Unix.pm:
If remote PID is unknown, still kill child remote shell process. Kill remote shell process after killing remote process (and time has passed).
Diffstat (limited to 'ACE')
-rw-r--r--ACE/bin/PerlACE/Process_Unix.pm34
1 files changed, 24 insertions, 10 deletions
diff --git a/ACE/bin/PerlACE/Process_Unix.pm b/ACE/bin/PerlACE/Process_Unix.pm
index a5295e6637b..448a66037f2 100644
--- a/ACE/bin/PerlACE/Process_Unix.pm
+++ b/ACE/bin/PerlACE/Process_Unix.pm
@@ -185,7 +185,7 @@ sub CommandLine ()
$self->{TARGET}->{TEST_ROOT});
$cur_root = $self->{TARGET}->{TEST_ROOT};
}
-
+
# Translate to different filesystem
if (defined $self->{TARGET} && defined $ENV{TEST_ROOT} &&
defined $self->{TARGET}->{TEST_FSROOT}) {
@@ -353,7 +353,7 @@ sub CommandLine ()
if (defined $ENV{'ACE_TEST_VERBOSE'}) {
print STDERR "INFO: created run script [",$self->{SCRIPTFILE},"]\n", $run_script;
}
- if (defined $self->{TARGET} &&
+ if (defined $self->{TARGET} &&
(defined $self->{TARGET}->{TARGET_FSROOT} ||
defined $self->{TARGET}->{TEST_ROOT})) {
# Already written to proper dir
@@ -724,20 +724,29 @@ sub Kill ($)
$self->{REMOTE_PID} = $rc;
}
}
- if (!defined $self->{REMOTE_PID}) {
- print STDERR "ERROR: Remote command: $! No PID found at Kill.\n";
- return -1;
- }
+ my $child_killed = 0;
+
if ($self->{RUNNING} && !defined $ENV{'ACE_TEST_WINDOW'}) {
if (defined $self->{TARGET} && defined $self->{TARGET}->{REMOTE_SHELL}) {
- my $cmd = $self->{TARGET}->{REMOTE_SHELL}." kill -s KILL ".$self->{REMOTE_PID};
- if (defined $ENV{'ACE_TEST_VERBOSE'}) {
- print STDERR "INFO: Killing remote process <", $cmd, ">\n";
+ # Kill remote process
+ if (defined $self->{REMOTE_PID}) {
+ my $cmd = $self->{TARGET}->{REMOTE_SHELL}." kill -s KILL ".$self->{REMOTE_PID};
+ if (defined $ENV{'ACE_TEST_VERBOSE'}) {
+ print STDERR "INFO: Killing remote process <", $cmd, ">\n";
+ select(undef, undef, undef, .5);
+ }
+ $cmd = `$cmd 2>&1`;
+ # Wait to give remote process time to exit
+ select(undef, undef, undef, 3.0);
+ } else {
+ print STDERR "INFO: remote process PID unknown, can't kill\n";
}
- $cmd = `$cmd 2>&1`;
} else {
kill ('KILL', $self->{PROCESS});
+ $child_killed = 1;
}
+
+
for(my $i = 0; $i < 10; $i++) {
my $pid = waitpid ($self->{PROCESS}, WNOHANG);
if ($pid > 0) {
@@ -747,6 +756,11 @@ sub Kill ($)
last;
}
else {
+ if (!$child_killed) {
+ # Kill child process (may be remote shell))
+ kill ('KILL', $self->{PROCESS});
+ $child_killed = 1;
+ }
select(undef, undef, undef, .5);
}
}