aboutsummaryrefslogtreecommitdiffhomepage
path: root/System
diff options
context:
space:
mode:
authorGravatar simonmar <unknown>2004-10-27 10:51:15 +0000
committerGravatar simonmar <unknown>2004-10-27 10:51:15 +0000
commit27196355eace8901dc6d805a8ec159d47081e6ef (patch)
tree748365a3275d44c4902c6250d9ff286c93048eef /System
parente431f43f860ace1776ff6a61699f220b5cfe4ec6 (diff)
[project @ 2004-10-27 10:51:15 by simonmar]
Fix bug in forkProcess: we weren't wrapping the forked IO action in the default exception handler, so exitFailure wasn't working properly.
Diffstat (limited to 'System')
-rw-r--r--System/Posix/Process.hsc6
1 files changed, 5 insertions, 1 deletions
diff --git a/System/Posix/Process.hsc b/System/Posix/Process.hsc
index 5ba2eda..ae04c46 100644
--- a/System/Posix/Process.hsc
+++ b/System/Posix/Process.hsc
@@ -79,6 +79,10 @@ import System.Posix.Signals
import System.Process.Internals ( pPrPr_disableITimers, c_execvpe )
import Control.Monad
+#ifdef __GLASGOW_HASKELL__
+import GHC.TopHandler ( runIO )
+#endif
+
#ifdef __HUGS__
{-# CBITS HsUnix.c #-}
#endif
@@ -227,7 +231,7 @@ in case of an error, an exception is thrown.
forkProcess :: IO () -> IO ProcessID
forkProcess action = do
- stable <- newStablePtr action
+ stable <- newStablePtr (runIO action)
pid <- throwErrnoIfMinus1 "forkProcess" (forkProcessPrim stable)
freeStablePtr stable
return $ fromIntegral pid