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 #if !defined(mingw32_TARGET_OS) && !defined(__MINGW32__)
25 import System.Posix.Types ( CPid )
27 import Data.Word ( Word32 )
29 import Foreign.C.String ( CString )
30 import Foreign.C.Types ( CInt )
31 import Foreign.Ptr ( Ptr )
34 {-# CBITS execvpe.c #-}
37 -- ----------------------------------------------------------------------------
40 {- | A handle to a process, which can be used to wait for termination
41 of the process using 'waitForProcess'.
43 None of the process-creation functions in this library wait for
44 termination: they all return a 'ProcessHandle' which may be used
45 to wait for the process later.
47 #if !defined(mingw32_TARGET_OS) && !defined(__MINGW32__)
53 newtype ProcessHandle = ProcessHandle PHANDLE
55 -- ----------------------------------------------------------------------------
57 #if !defined(mingw32_TARGET_OS) && !defined(__MINGW32__)
59 -- this function disables the itimer, which would otherwise cause confusing
60 -- signals to be sent to the new process.
61 foreign import ccall unsafe "pPrPr_disableITimers"
62 pPrPr_disableITimers :: IO ()
64 foreign import ccall unsafe "execvpe"
65 c_execvpe :: CString -> Ptr CString -> Ptr CString -> IO CInt