Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
The effect SystemProcess
is a low-level abstraction of a native system process.
Synopsis
- data SystemProcess :: Effect
- wait :: forall r. Member SystemProcess r => Sem r ExitCode
- signal :: forall r. Member SystemProcess r => Signal -> Sem r ()
- withSystemProcess :: forall param err r. Member (Scoped param (SystemProcess !! err)) r => param -> InterpreterFor (SystemProcess !! err) r
- interrupt :: Member SystemProcess r => Sem r ()
- pid :: forall r. Member SystemProcess r => Sem r Pid
- readStderr :: forall r. Member SystemProcess r => Sem r ByteString
- readStdout :: forall r. Member SystemProcess r => Sem r ByteString
- writeStdin :: forall r. Member SystemProcess r => ByteString -> Sem r ()
- type SysProcConf = ProcessConfig () () ()
- interpretSystemProcessNative :: forall param r. Members [Resource, Embed IO] r => (param -> Sem r (Either Text SysProcConf)) -> InterpreterFor (Scoped param (SystemProcess !! SystemProcessError) !! SystemProcessScopeError) r
- interpretSystemProcessWithProcess :: forall r. Member (Embed IO) r => Process Handle Handle Handle -> InterpreterFor (SystemProcess !! SystemProcessError) r
- interpretSystemProcessNativeSingle :: forall r. Members [Stop SystemProcessScopeError, Resource, Embed IO] r => SysProcConf -> InterpreterFor (SystemProcess !! SystemProcessError) r
- module Polysemy.Process.SysProcConf
- currentPid :: Member (Embed IO) r => Sem r Pid
Documentation
data SystemProcess :: Effect Source #
Low-level interface for a process, operating on raw chunks of bytes. Interface is modeled after System.Process.
wait :: forall r. Member SystemProcess r => Sem r ExitCode Source #
Wait for the process to terminate, returning its exit code.
signal :: forall r. Member SystemProcess r => Signal -> Sem r () Source #
Send a Signal
to the process.
withSystemProcess :: forall param err r. 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
.
readStderr :: forall r. Member SystemProcess r => Sem r ByteString Source #
Read a chunk from stderr.
readStdout :: forall r. Member SystemProcess r => Sem r ByteString Source #
Read a chunk from stdout.
writeStdin :: forall r. 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 Handle
s.
interpretSystemProcessNative :: forall param r. 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.
interpretSystemProcessWithProcess :: forall r. Member (Embed IO) r => Process Handle Handle Handle -> InterpreterFor (SystemProcess !! SystemProcessError) r Source #
Interpret SystemProcess
with a concrete Process
with connected pipes.
interpretSystemProcessNativeSingle :: forall r. Members [Stop SystemProcessScopeError, Resource, Embed IO] r => SysProcConf -> InterpreterFor (SystemProcess !! SystemProcessError) r Source #
Interpret SystemProcess
as a single global Process
that's started immediately.
module Polysemy.Process.SysProcConf