-
Effekt Library
- process
- exit
- WritableStream
- SpawnOptions
- default
- onStdout
- onStderr
- withStdin
- write
- close
- ExitStatus
- Exited
- Signaled
- spawn
- internal
- chain
- exitStatus
- piped
- spawn
- process Jump to source: libraries/common/process.effekt
- exit
(errorCode: Int): Nothing / {} - WritableStream
- SpawnOptions
(stdin: Option[(WritableStream) => Unit at {io,global}], stdout: Option[(String) => Unit at {io,global}], stderr: Option[(String) => Unit at {io,global}]) - default
: SpawnOptions / {} - onStdout
(opts: SpawnOptions, callback: (String) => Unit at {io,global}): SpawnOptions / {} - onStderr
(opts: SpawnOptions, callback: (String) => Unit at {io,global}): SpawnOptions / {} - withStdin
(opts: SpawnOptions, callback: (WritableStream) => Unit at {io,global}): SpawnOptions / {} - write
(to: WritableStream, s: String): Unit / {} - close
(to: WritableStream): Unit / {} - ExitStatus
- Exited
(code: Int) - Signaled
(signal: Int) - spawn
(cmd: String, args: Array[String], options: SpawnOptions): ExitStatus / {Exception[IOError]} - internal
- chain
[A] (first: Option[(A) => Unit at {io,global}], then: (A) => Unit at {io,global}): (A) => Unit at {io,global} / {} - exitStatus
(status: Int): ExitStatus / {} - piped
[A] (callback: Option[A]): Int / {} - spawn
(cmd: String, args: Array[String], pipeStdin: Int, stdin: (WritableStream) => Unit at {io,global}, pipeStdout: Int, stdout: (String) => Unit at {io,global}, pipeStderr: Int, stderr: (String) => Unit at {io,global}): Int / {}
Example usage: examples/stdlib/process
Ends the program with the given `errorCode`, once its standard output and error are written.
The standard input of a spawned process.
How the standard streams of a spawned process are connected to it: each one is either inherited from this process (`None`), or piped to a given callback.
Pipes the process's standard output to `callback`, chunk by chunk.
Pipes the process's standard error to `callback`, chunk by chunk.
Pipes the process's standard input from `callback`, which runs once the process has started.
How a process ended: - either it exited with a `code`, which is its result even if it is not 0, - or it was terminated by a `signal`, numbered in a platform-specific way.
Runs `cmd` with `args`, connecting its standard streams as per `options`. Returns an `ExitStatus` once it has exited and its piped output has ended, so that every callback for that output has run. Raises `IOError` if it cannot be started, such as `ENOENT` for a missing command.
The result of `spawn` is the exit code, or the signal times 2^32 (exit codes have 32 bits on every platform).
1 if a stream is piped to a callback, 0 if it is inherited.