executeCommand

Execute command and return the output. Logs execution and throws an exception on failure.

string
executeCommand
(
Range
)
(
Range command
,
const string workdir = null
,)
if (
isInputRange!Range &&
isSomeString!(ElementType!Range)
)

Parameters

command Range

A range that is first filtered for non-null values. The zeroth element of the resulting range is the program and any remaining elements are the command-line arguments.

workdir string

The working directory for the new process. By default the child process inherits the parent's working directory.

logLevel LogLevel

Log level to log execution on.

Return Value

Type: string

Output of command.

Throws

std.process.ProcessException on command failure

Examples

auto greeting = executeCommand(["echo", "hello", "world"]);

assert(greeting == "hello world\n");

Meta