aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/Unix/Program.inc
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Support/Unix/Program.inc')
-rw-r--r--llvm/lib/Support/Unix/Program.inc8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Support/Unix/Program.inc b/llvm/lib/Support/Unix/Program.inc
index adfed22..375102c 100644
--- a/llvm/lib/Support/Unix/Program.inc
+++ b/llvm/lib/Support/Unix/Program.inc
@@ -387,7 +387,8 @@ pid_t(llvm::sys::wait4)(pid_t pid, int *status, int options,
ProcessInfo llvm::sys::Wait(const ProcessInfo &PI,
std::optional<unsigned> SecondsToWait,
std::string *ErrMsg,
- std::optional<ProcessStatistics> *ProcStat) {
+ std::optional<ProcessStatistics> *ProcStat,
+ bool Polling) {
struct sigaction Act, Old;
assert(PI.Pid && "invalid pid to wait on, process not started?");
@@ -408,12 +409,11 @@ ProcessInfo llvm::sys::Wait(const ProcessInfo &PI,
sigemptyset(&Act.sa_mask);
sigaction(SIGALRM, &Act, &Old);
// FIXME The alarm signal may be delivered to another thread.
-
alarm(*SecondsToWait);
}
// Parent process: Wait for the child process to terminate.
- int status;
+ int status = 0;
ProcessInfo WaitResult;
rusage Info;
if (ProcStat)
@@ -428,7 +428,7 @@ ProcessInfo llvm::sys::Wait(const ProcessInfo &PI,
// Non-blocking wait.
return WaitResult;
} else {
- if (SecondsToWait && errno == EINTR) {
+ if (SecondsToWait && errno == EINTR && !Polling) {
// Kill the child.
kill(PI.Pid, SIGKILL);