runCommand

fnCommandResult runCommand(string[] args)

Execute an external command and capture its output.

Parameters

argsArray of command arguments, where args[0] is the program name.

Returns

CommandResult containing exit status, stdout, and stderr.

Throws

Exception if the command cannot be spawned.

Examples

auto result = runCommand(["readelf", "-h", "test.elf"]);
if (result.status == 0) {
   writeln(result.output);
}