diff options
| author | Reid Spencer <rspencer@reidspencer.com> | 2005-12-22 20:00:16 +0000 | 
|---|---|---|
| committer | Reid Spencer <rspencer@reidspencer.com> | 2005-12-22 20:00:16 +0000 | 
| commit | ccd5b90f5874bfa4f92046f3ecac625b898efdaa (patch) | |
| tree | 576c53b7eccf850bd84d88277024af837976dc04 /llvm/lib/System/Unix | |
| parent | 7d05269769fcd61faa509e2c3a0b0b37be66defd (diff) | |
| download | bcm5719-llvm-ccd5b90f5874bfa4f92046f3ecac625b898efdaa.tar.gz bcm5719-llvm-ccd5b90f5874bfa4f92046f3ecac625b898efdaa.zip | |
For PR351:
* Allow the ExecuteAndWait to return negative values if a signal is
  detected as the reason for the child termination. This is needed to
  support bugpoint detecting bad things in its child processes.
llvm-svn: 24960
Diffstat (limited to 'llvm/lib/System/Unix')
| -rw-r--r-- | llvm/lib/System/Unix/Program.inc | 19 | 
1 files changed, 12 insertions, 7 deletions
| diff --git a/llvm/lib/System/Unix/Program.inc b/llvm/lib/System/Unix/Program.inc index 8aa0705726b..47810bdbeba 100644 --- a/llvm/lib/System/Unix/Program.inc +++ b/llvm/lib/System/Unix/Program.inc @@ -209,17 +209,22 @@ Program::ExecuteAndWait(const Path& path,      sigaction(SIGALRM, &Old, 0);    } -  // If the program exited normally with a zero exit status, return success! +  // Return the proper exit status. 0=success, >0 is programs' exit status, +  // <0 means a signal was returned, -9999999 means the program dumped core. +  int result = 0;    if (WIFEXITED (status)) -    return WEXITSTATUS(status); +    result = WEXITSTATUS(status);    else if (WIFSIGNALED(status)) -    return 1; -     +    result = 0 - WTERMSIG(status); +#ifdef WCOREDUMP +  if (WCOREDUMP(status)) +    result |= 0x01000000; +#endif +  return result;  #else -  throw std::string( -    "Program::ExecuteAndWait not implemented on this platform!\n"); +  return -99;  #endif -  return 0; +      }  } | 

