Safe Haskell | None |
---|---|
Language | GHC2021 |
Cabal.Matrix.ProcessRunner
Description
Run a single process and provide a live view of its output and termination.
Synopsis
- startProcess :: NonEmpty Text -> (ProcessMessage -> IO ()) -> IO ProcessHandle
- data ProcessMessage
- data OutputChannel
- data ProcessHandle
- signalProcess :: ProcessHandle -> ProcessSignal -> IO ()
- data ProcessSignal
Documentation
startProcess :: NonEmpty Text -> (ProcessMessage -> IO ()) -> IO ProcessHandle Source #
Start a process with the given commandline arguments in the background. The provided callback will be called (from other threads) when things happen to the process.
Note: if the current program should be compiled with -threaded
, see
waitForProcess
.
A process can be considered finished and its resources cleaned up after
receiving all three of
,
OnChannelClosed
Stdout
, and OnChannelClosed
Stderr
OnProcessExit
.
data ProcessMessage Source #
Constructors
OnProcessOutput OutputChannel ByteString | Note: Always sequenced before |
OnChannelClosed OutputChannel | Note: may be sequenced after |
OnProcessExit ExitCode |
data OutputChannel Source #
Instances
data ProcessHandle Source #
signalProcess :: ProcessHandle -> ProcessSignal -> IO () Source #
Send a signal to the process.
data ProcessSignal Source #
Constructors
SignalInterrupt | Attempt to interrupt the process with |
SignalTerminate | Attempt to interrupt the process with |