Skip to content

Program

Function proxy for an external program.

Constructor

Program value

Creates a program proxy.

Parameters

NameTypeDescription
value (Str | Sym | fs.Path) Program name or path.

Example

let clang = Program "clang++"
clang --version

Methods

(call) ...args …

Runs the program with the supplied command-line arguments.

Output is written to the configured streams. See External Programs for lookup, stream handling and pipeline behavior.

Parameters

NameTypeDescription
:stdin? (fs.Path | Iter[Value]) Source for standard input.
:stdout? (fs.Path | Sink[Value]) Destination for standard output.
:stderr? (fs.Path | Sink[Value] | :STDOUT:) Destination for standard error, or :STDOUT: to merge it with standard output.
:policy? Dict[{?signal: Signal | Int, ?grace: time.Duration | Int | Float, ?force: Bool}] Per-launch termination overrides: signal, grace and force, as with_policy takes them.
:mode? (:LINE: | :CHUNK:) Output framing. Defaults to :LINE:.
...args Command-line arguments.

Errors

Exception Condition
Error The program exited unsuccessfully

Example

let git = Program git
git status --short

which() -> (fs.Path | nil)

Resolves the program without running it.

Returns

nil when the program is not found.

Example

let git = Program :git:
echo $git.which()