abla/process/command

Generated from source.

Import with import "abla/process/command".

Source: abla/process/command/entry.ab

Command (class)

class Command(val native: LinuxCommand)

A reusable command configuration. The builder methods modify this configuration and return it for chaining.

ChildProcess (class)

class ChildProcess(val native: LinuxChildProcess)

A handle for a started child. A negative native process ID means the fork failed.

command (fun)

fun command(executable: string): Command

Creates a command for executable without running it. Execution searches PATH for a name with no slash and uses an explicit path as given.

Command.argument (extension fun)

fun Command.argument(value: string): Command

Appends value as one argument and returns this command. The argument is passed directly, without shell splitting.

Command.environment (extension fun)

fun Command.environment(name: string, value: string): Command

name set to value for the command; the rest of the environment carries over.

Command.removeEnvironment (extension fun)

fun Command.removeEnvironment(name: string): Command

name taken out of what the command inherits from this process.

Command.directory (extension fun)

fun Command.directory(path: string): Command

Runs the command in this directory.

Command.input (extension fun)

fun Command.input(path: string): Command

Standard input read from this file.

Command.output (extension fun)

fun Command.output(path: string): Command

Standard output written to this file. "/dev/null" discards it.

Command.errors (extension fun)

fun Command.errors(path: string): Command

Standard error written to this file. "/dev/null" discards it.

Command.run (extension fun)

fun Command.run(): int

Runs the command and waits for its status. Returns 127 on fork or child setup or exec failure, and -1 on wait failure.

Command.capture (extension fun)

fun Command.capture(): LinuxProcessResult

Runs the command to its end, with its standard output and exit status.

Command.execute (extension fun)

fun Command.execute(): int

Replaces this process with the command. Only returns, with 127, if that fails.

Command.captureText (extension fun)

fun Command.captureText(): string

Runs the command and returns captured standard output. Use capture when you also need the exit status.

Command.start (extension fun)

fun Command.start(): ChildProcess

Forks the command and returns immediately with a child handle. A failed fork gives a negative process ID. A later exec or setup failure exits the child with 127.

ChildProcess.stop (extension fun)

fun ChildProcess.stop(graceMilliseconds: int = 5000): int

Sends TERM to the child and polls for exit for up to graceMilliseconds. Sends KILL and waits if the child is still pending. Returns its status, or -1 for an invalid child or failed wait.

Pipeline (class)

class Pipeline(val stages: array<LinuxCommand>)

A sequence of command snapshots to connect by pipes.

RunningPipeline (class)

class RunningPipeline(val native: LinuxRunningPipeline)

A started pipeline whose result can be collected with wait or stop.

Command.pipe (extension fun)

fun Command.pipe(next: Command): Pipeline

Returns a new pipeline from snapshots of this command and next, in that order.

Pipeline.pipe (extension fun)

fun Pipeline.pipe(next: Command): Pipeline

Returns a new pipeline containing snapshots of the existing stages followed by next.

Pipeline.run (extension fun)

fun Pipeline.run(): LinuxPipelineResult

Runs the pipeline and returns each stage's status and any launch error. Output is not captured.

Pipeline.capture (extension fun)

fun Pipeline.capture(): LinuxPipelineResult

Runs the pipeline and returns its final standard output, stage statuses, and any launch error.

Pipeline.captureBoth (extension fun)

fun Pipeline.captureBoth(): LinuxPipelineResult

Runs the pipeline and returns captured output and errors, stage statuses, and any launch error.

Pipeline.start (extension fun)

fun Pipeline.start(): RunningPipeline

Starts the pipeline without waiting. Collect its stage statuses and launch error with wait.

RunningPipeline.wait (extension fun)

fun RunningPipeline.wait(): LinuxPipelineResult

Collects the pipeline result, including individual statuses and any launch error. Repeated calls return the same result.

RunningPipeline.stop (extension fun)

fun RunningPipeline.stop(graceMilliseconds: int = 5000): LinuxPipelineResult

Sends TERM to the process group, waits graceMilliseconds, sends KILL, and collects the result. Returns the existing result if already collected.

Command.captureBoth (extension fun)

fun Command.captureBoth(): LinuxPipelineResult

Runs this command as a one-stage pipeline and returns captured stdout and stderr, the stage status, and any launch error.

Built from Abla v0.2.79 source ba5d6b7d. Examples and generated signatures follow that source revision.