Thanks to visit codestin.com
Credit goes to effect-ts.github.io

Skip to main content Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App

CommandExecutor.ts overview

Since v1.0.0


Exports Grouped by Category


constructors

ExitCode

Signature

declare const ExitCode: Brand.Brand.Constructor<ExitCode>

Source

Since v1.0.0

ProcessId

Signature

declare const ProcessId: Brand.Brand.Constructor<ProcessId>

Source

Since v1.0.0

makeExecutor

Signature

declare const makeExecutor: (start: (command: Command) => Effect<Process, PlatformError, Scope>) => CommandExecutor

Source

Since v1.0.0

models

CommandExecutor (interface)

Signature

export interface CommandExecutor {
  readonly [TypeId]: TypeId

  /**
   * Returns the exit code of the command after the process has completed
   * execution.
   */
  readonly exitCode: (command: Command) => Effect<ExitCode, PlatformError>
  /**
   * Start running the command and return a handle to the running process.
   */
  readonly start: (command: Command) => Effect<Process, PlatformError, Scope>
  /**
   * Runs the command returning the entire output as a string with the
   * specified encoding.
   *
   * If an encoding is not specified, the encoding will default to `utf-8`.
   */
  readonly string: (command: Command, encoding?: string) => Effect<string, PlatformError>
  /**
   * Runs the command returning the entire output as an array of lines.
   *
   * If an encoding is not specified, the encoding will default to `utf-8`.
   */
  readonly lines: (command: Command, encoding?: string) => Effect<Array<string>, PlatformError>
  /**
   * Runs the command returning the output as a `Stream`.
   */
  readonly stream: (command: Command) => Stream<Uint8Array, PlatformError>
  /**
   * Runs the command returning the output as a `Stream` of lines.
   */
  readonly streamLines: (command: Command, encoding?: string) => Stream<string, PlatformError>
}

Source

Since v1.0.0

ExitCode (type alias)

Signature

type ExitCode = Brand.Branded<number, "ExitCode">

Source

Since v1.0.0

Process (interface)

Signature

export interface Process extends Inspectable {
  readonly [ProcessTypeId]: ProcessTypeId
  /**
   * The process identifier.
   */
  readonly pid: ProcessId
  /**
   * Waits for the process to exit and returns the `ExitCode` of the command
   * that was run.
   */
  readonly exitCode: Effect<ExitCode, PlatformError>
  /**
   * Returns `true` if the process is still running, otherwise returns `false`.
   */
  readonly isRunning: Effect<boolean, PlatformError>
  /**
   * Kills the running process with the provided signal.
   *
   * If no signal is provided, the signal will defaults to `SIGTERM`.
   */
  readonly kill: (signal?: Signal) => Effect<void, PlatformError>
  /**
   * The standard error stream of the process.
   */
  readonly stderr: Stream<Uint8Array, PlatformError>
  /**
   * The standard input sink of the process.
   */
  readonly stdin: Sink<void, Uint8Array, never, PlatformError>
  /**
   * The standard output stream of the process.
   */
  readonly stdout: Stream<Uint8Array, PlatformError>
}

Source

Since v1.0.0

ProcessId (type alias)

Signature

type ProcessId = Brand.Branded<number, "ProcessId">

Source

Since v1.0.0

Signal (type alias)

Signature

type Signal =
  | "SIGABRT"
  | "SIGALRM"
  | "SIGBUS"
  | "SIGCHLD"
  | "SIGCONT"
  | "SIGFPE"
  | "SIGHUP"
  | "SIGILL"
  | "SIGINT"
  | "SIGIO"
  | "SIGIOT"
  | "SIGKILL"
  | "SIGPIPE"
  | "SIGPOLL"
  | "SIGPROF"
  | "SIGPWR"
  | "SIGQUIT"
  | "SIGSEGV"
  | "SIGSTKFLT"
  | "SIGSTOP"
  | "SIGSYS"
  | "SIGTERM"
  | "SIGTRAP"
  | "SIGTSTP"
  | "SIGTTIN"
  | "SIGTTOU"
  | "SIGUNUSED"
  | "SIGURG"
  | "SIGUSR1"
  | "SIGUSR2"
  | "SIGVTALRM"
  | "SIGWINCH"
  | "SIGXCPU"
  | "SIGXFSZ"
  | "SIGBREAK"
  | "SIGLOST"
  | "SIGINFO"

Source

Since v1.0.0

symbols

ProcessTypeId

Signature

declare const ProcessTypeId: unique symbol

Source

Since v1.0.0

ProcessTypeId (type alias)

Signature

type ProcessTypeId = typeof ProcessTypeId

Source

Since v1.0.0

tags

CommandExecutor

Signature

declare const CommandExecutor: Tag<CommandExecutor, CommandExecutor>

Source

Since v1.0.0

type ids

TypeId

Signature

declare const TypeId: unique symbol

Source

Since v1.0.0

TypeId (type alias)

Signature

type TypeId = typeof TypeId

Source

Since v1.0.0

utils

Process (namespace)

Source

Since v1.0.0

Id (type alias)

Signature

type Id = ProcessId

Source

Since v1.0.0