Sat Jul 25 22:20:19 BST 2009 Ian Lynagh <igloo@earth.li>
* Make the code compatible with the stricter labelled-field parsing rules
diff -rN -u old-process/System/Process/Internals.hs new-process/System/Process/Internals.hs
|
old
|
new
|
|
| 213 | 213 | -- ----------------------------------------------------------------------------- |
| 214 | 214 | -- POSIX runProcess with signal handling in the child |
| 215 | 215 | |
| 216 | | runGenProcess_ fun CreateProcess{ cmdspec = cmdsp, |
| 217 | | cwd = mb_cwd, |
| 218 | | env = mb_env, |
| 219 | | std_in = mb_stdin, |
| 220 | | std_out = mb_stdout, |
| 221 | | std_err = mb_stderr, |
| 222 | | close_fds = mb_close_fds } |
| | 216 | runGenProcess_ fun (CreateProcess{ cmdspec = cmdsp, |
| | 217 | cwd = mb_cwd, |
| | 218 | env = mb_env, |
| | 219 | std_in = mb_stdin, |
| | 220 | std_out = mb_stdout, |
| | 221 | std_err = mb_stderr, |
| | 222 | close_fds = mb_close_fds }) |
| 223 | 223 | mb_sigint mb_sigquit |
| 224 | 224 | = do |
| 225 | 225 | let (cmd,args) = commandToProcess cmdsp |
| … |
… |
|
| 444 | 444 | #if __GLASGOW_HASKELL__ < 611 |
| 445 | 445 | withHandle_ fun hdl $ return . haFD |
| 446 | 446 | #else |
| 447 | | withHandle fun hdl $ \h@Handle__{haDevice=dev,..} -> |
| | 447 | withHandle fun hdl $ \h@(Handle__{haDevice=dev,..}) -> |
| 448 | 448 | case cast dev of |
| 449 | 449 | Just fd -> do |
| 450 | 450 | -- clear the O_NONBLOCK flag on this FD, if it is set, since |
diff -rN -u old-process/System/Process.hs new-process/System/Process.hs
|
old
|
new
|
|
| 135 | 135 | runProcess cmd args mb_cwd mb_env mb_stdin mb_stdout mb_stderr = do |
| 136 | 136 | (_,_,_,ph) <- |
| 137 | 137 | runGenProcess_ "runProcess" |
| 138 | | (proc cmd args){ cwd = mb_cwd, |
| 139 | | env = mb_env, |
| 140 | | std_in = mbToStd mb_stdin, |
| 141 | | std_out = mbToStd mb_stdout, |
| 142 | | std_err = mbToStd mb_stderr } |
| | 138 | ((proc cmd args){ cwd = mb_cwd, |
| | 139 | env = mb_env, |
| | 140 | std_in = mbToStd mb_stdin, |
| | 141 | std_out = mbToStd mb_stdout, |
| | 142 | std_err = mbToStd mb_stderr }) |
| 143 | 143 | Nothing Nothing |
| 144 | 144 | maybeClose mb_stdin |
| 145 | 145 | maybeClose mb_stdout |
| … |
… |
|
| 273 | 273 | |
| 274 | 274 | runInteractiveProcess cmd args mb_cwd mb_env = do |
| 275 | 275 | runInteractiveProcess1 "runInteractiveProcess" |
| 276 | | (proc cmd args){ cwd = mb_cwd, env = mb_env } |
| | 276 | ((proc cmd args){ cwd = mb_cwd, env = mb_env }) |
| 277 | 277 | |
| 278 | 278 | runInteractiveProcess1 |
| 279 | 279 | :: String |
| … |
… |
|
| 282 | 282 | runInteractiveProcess1 fun cmd = do |
| 283 | 283 | (mb_in, mb_out, mb_err, p) <- |
| 284 | 284 | runGenProcess_ fun |
| 285 | | cmd{ std_in = CreatePipe, |
| 286 | | std_out = CreatePipe, |
| 287 | | std_err = CreatePipe } |
| | 285 | (cmd{ std_in = CreatePipe, |
| | 286 | std_out = CreatePipe, |
| | 287 | std_err = CreatePipe }) |
| 288 | 288 | Nothing Nothing |
| 289 | 289 | return (fromJust mb_in, fromJust mb_out, fromJust mb_err, p) |
| 290 | 290 | |
| … |
… |
|
| 351 | 351 | -> IO String -- ^ stdout + stderr |
| 352 | 352 | readProcess cmd args input = do |
| 353 | 353 | (Just inh, Just outh, _, pid) <- |
| 354 | | createProcess (proc cmd args){ std_in = CreatePipe, |
| 355 | | std_out = CreatePipe, |
| 356 | | std_err = Inherit } |
| | 354 | createProcess ((proc cmd args){ std_in = CreatePipe, |
| | 355 | std_out = CreatePipe, |
| | 356 | std_err = Inherit }) |
| 357 | 357 | |
| 358 | 358 | -- fork off a thread to start consuming the output |
| 359 | 359 | output <- hGetContents outh |
| … |
… |
|
| 398 | 398 | -> IO (ExitCode,String,String) -- ^ exitcode, stdout, stderr |
| 399 | 399 | readProcessWithExitCode cmd args input = do |
| 400 | 400 | (Just inh, Just outh, Just errh, pid) <- |
| 401 | | createProcess (proc cmd args){ std_in = CreatePipe, |
| 402 | | std_out = CreatePipe, |
| 403 | | std_err = CreatePipe } |
| | 401 | createProcess ((proc cmd args){ std_in = CreatePipe, |
| | 402 | std_out = CreatePipe, |
| | 403 | std_err = CreatePipe }) |
| 404 | 404 | |
| 405 | 405 | outMVar <- newEmptyMVar |
| 406 | 406 | |