mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 23:52:03 +00:00
ShellCommand waitpid eintr signal fix
This commit is contained in:
parent
90d019a281
commit
882dde56ea
@ -114,7 +114,6 @@ bool ShellCommand::tryWaitProcessWithTimeout(size_t timeout_in_seconds)
|
|||||||
while (timeout_in_seconds != 0)
|
while (timeout_in_seconds != 0)
|
||||||
{
|
{
|
||||||
int waitpid_res = waitpid(pid, &status, WNOHANG);
|
int waitpid_res = waitpid(pid, &status, WNOHANG);
|
||||||
|
|
||||||
bool process_terminated_normally = (waitpid_res == pid);
|
bool process_terminated_normally = (waitpid_res == pid);
|
||||||
|
|
||||||
if (process_terminated_normally)
|
if (process_terminated_normally)
|
||||||
@ -271,8 +270,11 @@ int ShellCommand::tryWait()
|
|||||||
LOG_TRACE(getLogger(), "Will wait for shell command pid {}", pid);
|
LOG_TRACE(getLogger(), "Will wait for shell command pid {}", pid);
|
||||||
|
|
||||||
int status = 0;
|
int status = 0;
|
||||||
if (-1 == waitpid(pid, &status, 0))
|
while (waitpid(pid, &status, 0) < 0)
|
||||||
|
{
|
||||||
|
if (errno != EINTR)
|
||||||
throwFromErrno("Cannot waitpid", ErrorCodes::CANNOT_WAITPID);
|
throwFromErrno("Cannot waitpid", ErrorCodes::CANNOT_WAITPID);
|
||||||
|
}
|
||||||
|
|
||||||
LOG_TRACE(getLogger(), "Wait for shell command pid {} completed with status {}", pid, status);
|
LOG_TRACE(getLogger(), "Wait for shell command pid {} completed with status {}", pid, status);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user