hunk ./process.cabal 57 - filepath >= 1.1 && < 1.2 + filepath >= 1.1 && < 1.3 hunk ./cbits/runProcess.c 25 -static void -disableItimers() -{ -#if !defined(USE_TIMER_CREATE) - // we only need to do this if we're using itimers, because - // timer_create timers are not carried across a fork(). - stopTimer(); -#endif -} - hunk ./cbits/runProcess.c 76 + // See #4074. Sometimes fork() gets interrupted by the timer + // signal and keeps restarting indefinitely. + stopTimer(); + hunk ./cbits/runProcess.c 84 +#if __GLASGOW_HASKELL__ > 612 + startTimer(); +#endif hunk ./cbits/runProcess.c 106 - disableItimers(); hunk ./cbits/runProcess.c 212 + startTimer(); hunk ./process.cabal 2 -version: 1.0.1.2 +version: 1.0.1.3 hunk ./System/Process.hs 325 --- strictly, blocking until the process terminates, and returns either the output --- string, or, in the case of non-zero exit status, an error code, and --- any output. +-- strictly, blocking until the process terminates, and returns the output +-- string. hunk ./System/Process.hs 336 --- > Right "Thu Feb 7 10:03:39 PST 2008\n" +-- > "Thu Feb 7 10:03:39 PST 2008\n" hunk ./System/Process.hs 350 - -> IO String -- ^ stdout + stderr + -> IO String -- ^ stdout hunk ./System/Process.hs 338 --- The argumenst are: +-- The arguments are: +-- +-- * The command to run, which must be in the $PATH, or an absolute path hunk ./System/Process.hs 342 --- * The command to run, which must be in the $PATH, or an absolute path --- hunk ./System/Process.hs 311 - code <- throwErrnoIfMinus1 "waitForProcess" (c_waitForProcess h) - withProcessHandle ph $ \p_' -> - case p_' of - ClosedHandle e -> return (p_',e) - OpenHandle ph' -> do - closePHANDLE ph' - let e = if (code == 0) - then ExitSuccess - else (ExitFailure (fromIntegral code)) - return (ClosedHandle e, e) + alloca $ \pret -> do + throwErrnoIfMinus1_ "waitForProcess" (c_waitForProcess h pret) + withProcessHandle ph $ \p_' -> + case p_' of + ClosedHandle e -> return (p_',e) + OpenHandle ph' -> do + closePHANDLE ph' + code <- peek pret + let e = if (code == 0) + then ExitSuccess + else (ExitFailure (fromIntegral code)) + return (ClosedHandle e, e) hunk ./System/Process.hs 592 + -> Ptr CInt hunk ./cbits/runProcess.c 260 -int waitForProcess (ProcHandle handle) +int waitForProcess (ProcHandle handle, int *pret) hunk ./cbits/runProcess.c 272 - if (WIFEXITED(wstat)) - return WEXITSTATUS(wstat); + if (WIFEXITED(wstat)) { + *pret = WEXITSTATUS(wstat); + return 0; + } hunk ./cbits/runProcess.c 279 - return wstat; + *pret = wstat; + return 0; hunk ./cbits/runProcess.c 509 -waitForProcess (ProcHandle handle) +waitForProcess (ProcHandle handle, int *pret) hunk ./cbits/runProcess.c 520 - return retCode; + *pret = retCode; + return 0; hunk ./include/runProcess.h 75 -extern int waitForProcess( ProcHandle handle ); +extern int waitForProcess( ProcHandle handle, int *ret ); addfile ./tests/4198.hs hunk ./tests/4198.hs 1 +import System.Process +import System.FilePath +main = system ("." "exitminus1") >>= print addfile ./tests/4198.stdout hunk ./tests/4198.stdout 1 +ExitFailure 255 addfile ./tests/4198.stdout-i386-unknown-mingw32 hunk ./tests/4198.stdout-i386-unknown-mingw32 1 +ExitFailure (-1) hunk ./tests/all.T 21 +test('4198', cmd_prefix(config.compiler + ' exitminus1.c -o exitminus1; '), + compile_and_run, ['']) addfile ./tests/exitminus1.c hunk ./tests/exitminus1.c 1 +int main() { return -1; }