1
1

Ensure the ssh session is dead

Этот коммит содержится в:
Ralph Castain 2015-05-23 08:05:26 -07:00
родитель 920562d9b4
Коммит c21cd1c91e

Просмотреть файл

@ -1292,6 +1292,7 @@ static int rsh_finalize(void)
int rc, i; int rc, i;
orte_job_t *jdata; orte_job_t *jdata;
orte_proc_t *proc; orte_proc_t *proc;
pid_t ret;
/* remove launch event */ /* remove launch event */
opal_event_del(&launch_event); opal_event_del(&launch_event);
@ -1311,7 +1312,19 @@ static int rsh_finalize(void)
if (NULL == (proc = opal_pointer_array_get_item(jdata->procs, i))) { if (NULL == (proc = opal_pointer_array_get_item(jdata->procs, i))) {
continue; continue;
} }
if (proc->state < ORTE_PROC_STATE_UNTERMINATED && 0 < proc->pid) { if (0 < proc->pid) {
/* this is a daemon we started - see if the ssh process still exists */
ret = waitpid(proc->pid, &proc->exit_code, WNOHANG);
if (-1 == ret && ECHILD == errno) {
/* The pid no longer exists, so we'll call this "good
enough for government work" */
continue;
}
if (ret == proc->pid) {
/* already died */
continue;
}
/* ssh session must still be alive, so kill it */
kill(proc->pid, SIGKILL); kill(proc->pid, SIGKILL);
} }
} }