polysemy-process-0.14.1.1: Polysemy effects for system processes
Safe HaskellNone
LanguageGHC2021

Polysemy.Process.SystemProcess

Description

The effect SystemProcess is a low-level abstraction of a native system process.

Synopsis

Documentation

wait :: forall (r :: EffectRow). Member SystemProcess r => Sem r ExitCode Source #

Wait for the process to terminate, returning its exit code.

signal :: forall (r :: EffectRow). Member SystemProcess r => Signal -> Sem r () Source #

Send a Signal to the process.

data SystemProcess (a :: Type -> Type) b Source #

Low-level interface for a process, operating on raw chunks of bytes. Interface is modeled after System.Process.

withSystemProcess :: forall param err (r :: EffectRow). Member (Scoped param (SystemProcess !! err)) r => param -> InterpreterFor (SystemProcess !! err) r Source #

Create a scoped resource for SystemProcess. The process configuration may depend on the provided value of type param.

interrupt :: forall (r :: EffectRow). Member SystemProcess r => Sem r () Source #

Send signal INT(2) to the process.

pid :: forall (r :: EffectRow). Member SystemProcess r => Sem r Pid Source #

Obtain the process ID.

readStderr :: forall (r :: EffectRow). Member SystemProcess r => Sem r ByteString Source #

Read a chunk from stderr.

readStdout :: forall (r :: EffectRow). Member SystemProcess r => Sem r ByteString Source #

Read a chunk from stdout.

writeStdin :: forall (r :: EffectRow). Member SystemProcess r => ByteString -> Sem r () Source #

Write a ByteString to stdin.

type SysProcConf = ProcessConfig () () () Source #

Convenience alias for a vanilla ProcessConfig, which will usually be transformed by interpreters to use Handles.

interpretSystemProcessNative :: forall param (r :: EffectRow). Members '[Resource, Embed IO] r => (param -> Sem r (Either Text SysProcConf)) -> InterpreterFor (Scoped param (SystemProcess !! SystemProcessError) !! SystemProcessScopeError) r Source #

Interpret SystemProcess as a scoped Process that's started wherever withSystemProcess is called and terminated when the wrapped action finishes. This variant is for parameterized scopes, allowing the consumer to supply a value of type param to create the process config.

currentPid :: forall (r :: EffectRow). Member (Embed IO) r => Sem r Pid Source #

Obtain the current process's Pid.