Get rid of the printout from the low-level system interface

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15161 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2004-07-24 07:50:48 +00:00
parent e96b2ed211
commit 21ddf17ff6

View File

@ -182,34 +182,23 @@ int llvm::RunProgramWithTimeout(const std::string &ProgramPath,
alarm(NumSeconds); alarm(NumSeconds);
int Status; int Status;
while (wait(&Status) != Child) { while (wait(&Status) != Child)
if (errno == EINTR) { if (errno == EINTR) {
if (Timeout) { if (Timeout) {
static bool FirstTimeout = true; // Kill the child.
if (FirstTimeout) { kill(Child, SIGKILL);
std::cout <<
"*** Program execution timed out! This mechanism is designed to handle\n" if (wait(&Status) != Child)
" programs stuck in infinite loops gracefully. The -timeout option\n" std::cerr << "Something funny happened waiting for the child!\n";
" can be used to change the timeout threshold or disable it completely\n"
" (with -timeout=0). This message is only displayed once.\n"; alarm(0);
FirstTimeout = false; sigaction(SIGALRM, &Old, 0);
} return -1; // Timeout detected
} else {
std::cerr << "Error waiting for child process!\n";
exit(1);
} }
// Kill the child.
kill(Child, SIGKILL);
if (wait(&Status) != Child)
std::cerr << "Something funny happened waiting for the child!\n";
alarm(0);
sigaction(SIGALRM, &Old, 0);
return -1; // Timeout detected
} else {
std::cerr << "Error waiting for child process!\n";
exit(1);
} }
}
alarm(0); alarm(0);
sigaction(SIGALRM, &Old, 0); sigaction(SIGALRM, &Old, 0);