mirror of https://gitee.com/bigwinds/arangodb
added diagnostic output for waitpid
This commit is contained in:
parent
637b1582b2
commit
c6948d1cff
|
@ -983,7 +983,7 @@ TRI_external_status_t TRI_CheckExternalProcess (TRI_external_id_t pid,
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
TRI_pid_t res;
|
TRI_pid_t res;
|
||||||
int opts;
|
int opts;
|
||||||
int loc;
|
int loc = 0;
|
||||||
|
|
||||||
if (wait) {
|
if (wait) {
|
||||||
opts = WUNTRACED;
|
opts = WUNTRACED;
|
||||||
|
@ -995,21 +995,33 @@ TRI_external_status_t TRI_CheckExternalProcess (TRI_external_id_t pid,
|
||||||
if (res == 0) {
|
if (res == 0) {
|
||||||
external->_exitStatus = 0;
|
external->_exitStatus = 0;
|
||||||
}
|
}
|
||||||
else if (WIFEXITED(loc)) {
|
else if (res == -1) {
|
||||||
external->_status = TRI_EXT_TERMINATED;
|
LOG_WARNING("waitpid returned error for pid %d: %s",
|
||||||
external->_exitStatus = WEXITSTATUS(loc);
|
(int) external->_pid,
|
||||||
|
TRI_errno_string(errno));
|
||||||
}
|
}
|
||||||
else if (WIFSIGNALED(loc)) {
|
else if (static_cast<TRI_pid_t>(external->_pid) == static_cast<TRI_pid_t>(res)) {
|
||||||
external->_status = TRI_EXT_ABORTED;
|
if (WIFEXITED(loc)) {
|
||||||
external->_exitStatus = WTERMSIG(loc);
|
external->_status = TRI_EXT_TERMINATED;
|
||||||
}
|
external->_exitStatus = WEXITSTATUS(loc);
|
||||||
else if (WIFSTOPPED(loc)) {
|
}
|
||||||
external->_status = TRI_EXT_STOPPED;
|
else if (WIFSIGNALED(loc)) {
|
||||||
external->_exitStatus = 0;
|
external->_status = TRI_EXT_ABORTED;
|
||||||
|
external->_exitStatus = WTERMSIG(loc);
|
||||||
|
}
|
||||||
|
else if (WIFSTOPPED(loc)) {
|
||||||
|
external->_status = TRI_EXT_STOPPED;
|
||||||
|
external->_exitStatus = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
external->_status = TRI_EXT_ABORTED;
|
||||||
|
external->_exitStatus = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
external->_status = TRI_EXT_ABORTED;
|
LOG_WARNING("unexpected waitpid result for pid %d: %d",
|
||||||
external->_exitStatus = 0;
|
(int) external->_pid,
|
||||||
|
(int) res);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (wait) {
|
if (wait) {
|
||||||
|
@ -1021,7 +1033,7 @@ TRI_external_status_t TRI_CheckExternalProcess (TRI_external_id_t pid,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DWORD exitCode = STILL_ACTIVE;
|
DWORD exitCode = STILL_ACTIVE;
|
||||||
if (!GetExitCodeProcess(external->_process , &exitCode)) {
|
if (! GetExitCodeProcess(external->_process , &exitCode)) {
|
||||||
LOG_WARNING("exit status could not be determined for PID '%ud'",
|
LOG_WARNING("exit status could not be determined for PID '%ud'",
|
||||||
external->_pid);
|
external->_pid);
|
||||||
}
|
}
|
||||||
|
@ -1036,6 +1048,11 @@ TRI_external_status_t TRI_CheckExternalProcess (TRI_external_id_t pid,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
LOG_WARNING("unexpected process status %d: %d",
|
||||||
|
(int) external->_status,
|
||||||
|
(int) external->_exitStatus);
|
||||||
|
}
|
||||||
|
|
||||||
status._status = external->_status;
|
status._status = external->_status;
|
||||||
status._exitStatus = external->_exitStatus;
|
status._exitStatus = external->_exitStatus;
|
||||||
|
|
Loading…
Reference in New Issue