haskell / haskell/process

Does not work with async exceptions

Open
#107 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
91
Forks
91
PR merge metrics
No merged PRs in 30d

Description

Given the code `Proc.hs`:

```haskell
import System.Process
import System.Time.Extra

main = do
(t, e) <- duration $ timeout 2 $ system "sleep 5s"
print (showDuration t, e)
(t, e) <- duration $ timeout 2 $ do
(_, _, _, pid) <- createProcess (proc "sleep" ["5s"])
waitForProcess pid
print (showDuration t, e)
(t, e) <- duration $ timeout 2 $ do
withCreateProcess (proc "sleep" ["5s"]) $ \_ _ _ pid -> waitForProcess pid
print (showDuration t, e)
```

I observe:

```
C:\Neil\temp>ghc Proc.hs -package=process-1.6.2.0 && proc
[1 of 1] Compiling Main ( Proc.hs, Proc.o )
Linking Proc.exe ...
("5.06s",Just ExitSuccess)
("5.05s",Just ExitSuccess)
("5.04s",Just ExitSuccess)

C:\Neil\temp>ghc Proc.hs -package=process-1.6.2.0 -threaded && proc
[1 of 1] Compiling Main ( Proc.hs, Proc.o )
Linking Proc.exe ...
("5.48s",Nothing)
("5.49s",Nothing)
proc: terminateProcess: permission denied (Permission denied)
```

Running Windows 10, 64bit GHC 8.2.1, process 1.6.2.0. Requires the extra library to be installed and the `sleep` binary to be on `%PATH%`. I would expect all these functions to die around `2s`, but none of the timeouts are effective.

Originally found when debugging an upstream bug in Shake: https://github.com/ndmitchell/shake/issues/538

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.