Description
When delegate_ctlc
is used then waitForProcess
throws UserInterrupt
if the child terminated due to ctrl-c
.
However, we ignore any such exceptions.
- We call
waitForProcess
heretyped-process/src/System/Process/Typed.hs
Line 226 in 788209f
- Any exceptions will then be turned into a
Left
-value heretyped-process/src/System/Process/Typed.hs
Line 250 in 788209f
- Finally we ignore them here
typed-process/src/System/Process/Typed.hs
Line 258 in 788209f
AsyncCancelled
)
#70 addresses this specific problem.
However, we also deadlock on waitExitCode
with delegate_ctlc
on ctrl-c
, as in that case pExitCode
will be left empty:
$ cabal exec -- ghci -isrc src/System/Process/Typed.hs
ghci> withProcessWait (setDelegateCtlc True $ proc "sleep" ["100"]) $ \ p -> waitExitCode p
^C
*** Exception: thread blocked indefinitely in an STM transaction
(I'm using cabal exec
instead of stack exec
here, as stack exec
fails with a different error. I assume that this is due to stack
using typed-process
itself and hence it is itself affected by this bug and #69.)
You could address this by say storing an Either SomeException ExitCode
in pExitCode
, but async
already solved this for us. So I think we should rely on async
instead.
Once we are done with #70, I'll open a PR along the lines of sol@3e37a48, which addresses this issue.