executeShell

Execute shellCommand and return the output. Logs execution on LogLevel.diagnostic and throws an exception on failure.

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

Parameters

shellCommand Range

A range command that first filtered for non-null values, then joined by spaces and then passed verbatim to the shell.

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 = executeShell(["echo", "hello", "world", "|", "rev"]);

assert(greeting == "dlrow olleh\n");

Meta