Graham Klyne wrote:
Is "forkProcess" in the sense of a Unix fork?
Yes; but Simon's code only uses that to provide the Unix implementation of runProcess and runInteractiveProcess. Those functions are essentially combined fork+exec operations, so it should be possible to implement them using Windows' CreateProcess(). For anyone who can't read the Process.hs attachment in Simon's message (it is base64 encoded), the documentation and types of those functions are: -- runProcess {- | Runs a raw command, optionally specifying 'Handle's from which to take the @stdin@, @stdout@ and @stderr@ channels for the new process. These 'Handle's may be created by 'createPipe', in order to set up communication channels with the remote process (but see also 'runInteractiveProcess' if you want to do this). -} runProcess :: FilePath -- ^ Filename of the executable -> [String] -- ^ Arguments to pass to the executable -> Maybe [(String,String)] -- ^ Optional environment (otherwise inherit) -> Maybe Handle -- ^ Handle to use for @stdin@ -> Maybe Handle -- ^ Handle to use for @stdout@ -> Maybe Handle -- ^ Handle to use for @stderr@ -> IO ProcessHandle -- runInteractiveProcess {- | Runs a raw command, and returns 'Handle's that may be used to communicate with the process via its @stdin@, @stdout@ and @stderr@ respectively. 'runInteractiveProcess' may not be implementable in terms of 'runProcess' and 'createPipe', because of the need to ensure that the ends of the pipes that the child process does not use are closed correctly (otherwise the child process will not be able to receive EOF on stdin when the parent process closes the stdin 'Handle', for example). -} runInteractiveProcess :: FilePath -- ^ Filename of the executable -> [String] -- ^ Arguments to pass to the executable -> Maybe [(String,String)] -- ^ Optional environment (otherwise inherit) -> IO (Handle,Handle,Handle,ProcessHandle) -- Glynn Clements <glynn.clements@virgin.net>