Skip to content

We are silently ignoring UserInterrupts on delegate_ctlc #73

Open
@sol

Description

@sol

When delegate_ctlc is used then waitForProcess throws UserInterrupt if the child terminated due to ctrl-c.

However, we ignore any such exceptions.

  1. We call waitForProcess here
    then P.waitForProcess pHandle
  2. Any exceptions will then be turned into a Left-value here
    eec <- waitCatch waitingThread
  3. Finally we ignore them here (wrongly assuming that it can only be an 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions