Merge pull request from Icinga/bugfix/timeout-always-unknown

Override exit code on process timeout
This commit is contained in:
Julian Brost 2021-07-28 11:56:42 +02:00 committed by GitHub
commit cc8d3fbedd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 2 deletions
lib/base

View File

@ -1133,8 +1133,14 @@ bool Process::DoEvents()
} else if (WIFEXITED(status)) { } else if (WIFEXITED(status)) {
exitcode = WEXITSTATUS(status); exitcode = WEXITSTATUS(status);
Log(LogNotice, "Process") Log msg(LogNotice, "Process");
<< "PID " << m_PID << " (" << PrettyPrintArguments(m_Arguments) << ") terminated with exit code " << exitcode; msg << "PID " << m_PID << " (" << PrettyPrintArguments(m_Arguments)
<< ") terminated with exit code " << exitcode;
if (m_SentSigterm) {
exitcode = 128;
msg << " after sending SIGTERM";
}
} else if (WIFSIGNALED(status)) { } else if (WIFSIGNALED(status)) {
int signum = WTERMSIG(status); int signum = WTERMSIG(status);
const char *zsigname = strsignal(signum); const char *zsigname = strsignal(signum);