• Effekt Logo 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
      Example usage: examples/stdlib/process
      • exit (errorCode: Int): Nothing / {}
      • Ends the program with the given `errorCode`, once its standard output and error are written.
      • WritableStream
      • The standard input of a spawned process.
      • SpawnOptions (stdin: Option[(WritableStream) => Unit at {io,global}], stdout: Option[(String) => Unit at {io,global}], stderr: Option[(String) => Unit at {io,global}])
      • 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.
      • default : SpawnOptions / {}
      • onStdout (opts: SpawnOptions, callback: (String) => Unit at {io,global}): SpawnOptions / {}
      • Pipes the process's standard output to `callback`, chunk by chunk.
      • onStderr (opts: SpawnOptions, callback: (String) => Unit at {io,global}): SpawnOptions / {}
      • Pipes the process's standard error to `callback`, chunk by chunk.
      • withStdin (opts: SpawnOptions, callback: (WritableStream) => Unit at {io,global}): SpawnOptions / {}
      • Pipes the process's standard input from `callback`, which runs once the process has started.
      • write (to: WritableStream, s: String): Unit / {}
      • close (to: WritableStream): Unit / {}
      • ExitStatus
      • 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.
        • Exited (code: Int)
        • Signaled (signal: Int)
      • spawn (cmd: String, args: Array[String], options: SpawnOptions): ExitStatus / {Exception[IOError]}
      • 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.
      • 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 / {}
        • The result of `spawn` is the exit code, or the signal times 2^32 (exit codes have 32 bits on every platform).
        • piped [A] (callback: Option[A]): Int / {}
        • 1 if a stream is piped to a callback, 0 if it is inherited.
        • 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 / {}