System.system
Ian Lynagh <[email protected]> Tue, 10 Feb 2004 23:37:02 +0000
| Newsgroups | gmane.comp.lang.haskell.nhc.bugs |
|---|---|
| Message-ID | <[email protected]> |
Hi,
In src/prelude/System/SystemFun.hs the OS's system function is called to
implement System.system. However, the various checks are not done and
WEXITSTATUS is not applied as appropriate.
It looks like src/runtime/Builtin/cSystem.c does the same thing.
src/libraries/base/System/Cmd.hs uses systemCmd when __GLASGOW_HASKELL__
is defined, which is defined in libraries/base/cbits/system.c. This
looks like it is doing the right stuff.
This causes this:
-----8<----------8<----------8<----------8<-----
main :: IO ()
main = mapM_ f [0..5]
f :: Int -> IO ()
f i = do x <- system $ "exit " ++ show i
print x
-----8<----------8<----------8<----------8<-----
to output this for me:
ExitSuccess
ExitFailure 256
ExitFailure 512
ExitFailure 768
ExitFailure 1024
ExitFailure 1280
Thanks
Ian