1 {-# OPTIONS -cpp -fffi #-}
2 -----------------------------------------------------------------------------
4 -- Module : System.Process.Internals
5 -- Copyright : (c) The University of Glasgow 2004
6 -- License : BSD-style (see the file libraries/base/LICENSE)
8 -- Maintainer : libraries@haskell.org
9 -- Stability : experimental
10 -- Portability : portable
12 -- Operations for creating and interacting with sub-processes.
14 -----------------------------------------------------------------------------
17 module System.Process.Internals (
18 ProcessHandle(..), PHANDLE,
19 #if !defined(mingw32_TARGET_OS) && !defined(__MINGW32__)
20 pPrPr_disableITimers, c_execvpe
24 import Prelude -- necessary to get dependencies right
26 #if !defined(mingw32_TARGET_OS) && !defined(__MINGW32__)
27 import System.Posix.Types ( CPid )
29 import Data.Word ( Word32 )
31 import Foreign.C.String ( CString )
32 import Foreign.C.Types ( CInt )
33 import Foreign.Ptr ( Ptr )
36 {-# CFILES cbits/execvpe.c #-}
39 -- ----------------------------------------------------------------------------
42 {- | A handle to a process, which can be used to wait for termination
43 of the process using 'waitForProcess'.
45 None of the process-creation functions in this library wait for
46 termination: they all return a 'ProcessHandle' which may be used
47 to wait for the process later.
49 #if !defined(mingw32_TARGET_OS) && !defined(__MINGW32__)
55 newtype ProcessHandle = ProcessHandle PHANDLE
57 -- ----------------------------------------------------------------------------
59 #if !defined(mingw32_TARGET_OS) && !defined(__MINGW32__)
61 -- this function disables the itimer, which would otherwise cause confusing
62 -- signals to be sent to the new process.
63 foreign import ccall unsafe "pPrPr_disableITimers"
64 pPrPr_disableITimers :: IO ()
66 foreign import ccall unsafe "execvpe"
67 c_execvpe :: CString -> Ptr CString -> Ptr CString -> IO CInt