aboutsummaryrefslogtreecommitdiff
path: root/lib/Support/Unix
diff options
context:
space:
mode:
authorAndrew Trick <atrick@apple.com>2011-05-21 00:56:46 +0000
committerAndrew Trick <atrick@apple.com>2011-05-21 00:56:46 +0000
commitdc5948d47205fd05184a25251e128db6a47b25c2 (patch)
tree79eabc660d9d50197ac5b3182ac793e88b9dbc82 /lib/Support/Unix
parent5c2256a5719172273eaef198f92d8af924ff8623 (diff)
Have Program::Wait return -2 for crashed and timeouts instead of embedding
info in the error message. Per Dan's request. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131780 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/Unix')
-rw-r--r--lib/Support/Unix/Program.inc13
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/Support/Unix/Program.inc b/lib/Support/Unix/Program.inc
index 86f3aa9eac..346baf1744 100644
--- a/lib/Support/Unix/Program.inc
+++ b/lib/Support/Unix/Program.inc
@@ -298,8 +298,7 @@ Program::Execute(const Path &path, const char **args, const char **envp,
int
Program::Wait(const sys::Path &path,
unsigned secondsToWait,
- std::string* ErrMsg,
- const char* SignalPrefix)
+ std::string* ErrMsg)
{
#ifdef HAVE_SYS_WAIT_H
struct sigaction Act, Old;
@@ -339,7 +338,7 @@ Program::Wait(const sys::Path &path,
else
MakeErrMsg(ErrMsg, "Child timed out", 0);
- return -1; // Timeout detected
+ return -2; // Timeout detected
} else if (errno != EINTR) {
MakeErrMsg(ErrMsg, "Error waiting for child process");
return -1;
@@ -377,15 +376,15 @@ Program::Wait(const sys::Path &path,
}
} else if (WIFSIGNALED(status)) {
if (ErrMsg) {
- if (SignalPrefix)
- *ErrMsg = SignalPrefix;
- *ErrMsg += strsignal(WTERMSIG(status));
+ *ErrMsg = strsignal(WTERMSIG(status));
#ifdef WCOREDUMP
if (WCOREDUMP(status))
*ErrMsg += " (core dumped)";
#endif
}
- return -1;
+ // Return a special value to indicate that the process received an unhandled
+ // signal during execution as opposed to failing to execute.
+ return -2;
}
return result;
#else