cabal-matrix-1.0.0.0: Matrix builds for cabal
Safe HaskellNone
LanguageGHC2021

Cabal.Matrix.ProcessRunner

Description

Run a single process and provide a live view of its output and termination.

Synopsis

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, OnChannelClosed Stderr, and OnProcessExit.

data ProcessMessage Source #

Constructors

OnProcessOutput OutputChannel ByteString

Note: Always sequenced before OnChannelClosed, but may be sequenced after OnProcessExit.

OnChannelClosed OutputChannel

Note: may be sequenced after OnProcessExit.

OnProcessExit ExitCode 

data OutputChannel Source #

Constructors

Stdout 
Stderr 

Instances

Instances details
FromJSON OutputChannel Source # 
Instance details

Defined in Cabal.Matrix.ProcessRunner

ToJSON OutputChannel Source # 
Instance details

Defined in Cabal.Matrix.ProcessRunner

Generic OutputChannel Source # 
Instance details

Defined in Cabal.Matrix.ProcessRunner

Associated Types

type Rep OutputChannel 
Instance details

Defined in Cabal.Matrix.ProcessRunner

type Rep OutputChannel = D1 ('MetaData "OutputChannel" "Cabal.Matrix.ProcessRunner" "cabal-matrix-1.0.0.0-6d6v0bFUrGrBBiTUHolWwF" 'False) (C1 ('MetaCons "Stdout" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Stderr" 'PrefixI 'False) (U1 :: Type -> Type))
Show OutputChannel Source # 
Instance details

Defined in Cabal.Matrix.ProcessRunner

Eq OutputChannel Source # 
Instance details

Defined in Cabal.Matrix.ProcessRunner

type Rep OutputChannel Source # 
Instance details

Defined in Cabal.Matrix.ProcessRunner

type Rep OutputChannel = D1 ('MetaData "OutputChannel" "Cabal.Matrix.ProcessRunner" "cabal-matrix-1.0.0.0-6d6v0bFUrGrBBiTUHolWwF" 'False) (C1 ('MetaCons "Stdout" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Stderr" 'PrefixI 'False) (U1 :: Type -> Type))

signalProcess :: ProcessHandle -> ProcessSignal -> IO () Source #

Send a signal to the process.

data ProcessSignal Source #

Constructors

SignalInterrupt

Attempt to interrupt the process with SIGINT.

SignalTerminate

Attempt to interrupt the process with SIGTERM.