script: kill child process on error

The recent change in code improves main-pool on error, but we need
to kill child process if it still running to avoid hang up in next
waitpid().

Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2020-09-21 12:51:02 +02:00
parent 5c6903b159
commit 8deb45fc56
2 changed files with 6 additions and 1 deletions

View File

@ -631,6 +631,12 @@ int ul_pty_proxy_master(struct ul_pty *pty)
break;
}
if (rc && pty->child && pty->child != (pid_t) -1 && !pty->delivered_signal) {
kill(pty->child, SIGTERM);
sleep(2);
kill(pty->child, SIGKILL);
}
pty_signals_cleanup(pty);
DBG(IO, ul_debug("poll() done [signal=%d, rc=%d]", pty->delivered_signal, rc));

View File

@ -673,7 +673,6 @@ static int callback_log_stream_activity(void *data, int fd, char *buf, size_t bu
ctl->outsz += ssz;
/* check output limit */
if (ctl->maxsz != 0 && ctl->outsz >= ctl->maxsz) {
if (!ctl->quiet)