LocalShell class final

Minimal local shell backed by dart:io Process.

Executes commands via sh -c (POSIX) or cmd /c (Windows). Streaming callbacks receive output chunks as they arrive; timeout and cancellation kill the process. This is the v1 shell — pi's richer bash-discovery logic is deferred until a tool actually needs it.

Implemented types

Constructors

LocalShell()
Creates a LocalShell.
const

Properties

backgroundJobsSupported bool
Whether startShellJob actually works here. Decorators forward their delegate's answer, so wrapping an env never fakes the capability.
no setteroverride
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

exec(String command, {ShellExecOptions? options}) Future<Result<ShellExecResult, ExecutionError>>
Executes a shell command. Must never throw: all failures are encoded in the returned Result.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
startShellJob(String command, {required String id, required String logPath, ShellExecOptions? options}) Future<Result<ShellJob, ExecutionError>>
Starts command detached: stdout/stderr append to logPath and the returned ShellJob keeps running until it exits or is stopped. ShellExecOptions.timeout and ShellExecOptions.cancelToken still apply (both stop the job).
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

jobsGetOwnProcessGroup bool
Whether background jobs start as their own session and process-group leader (setsid sh -c …, posix only): stop() then signals the whole tree with one group kill, and the boot sweep can recognize a job's leftover group after a crash (issue #517). setsid execs sh in place — no fork — so the tracked pid IS the group id.
no setter
ownProcessGroupOverride bool?
Test seam: pin the own-process-group decision before the first job of a test starts. Null = probe the host once.
getter/setter pair

Static Methods

killTree(int pid, {required bool ownGroup}) Future<void>
Terminates pid's whole process tree (issue #517): the process group when the job is its own group leader (one signal — also covers children forked while the kill runs), otherwise a live ps descendant walk; Windows delegates to taskkill /T. TERM first, a short grace, then KILL. Best-effort: never throws.