tryRun

Runs a command, through the system's command shell interpreter, in typical shell-script style: Synchronously, with the command's stdout/in/err automatically forwarded through your program's stdout/in/err.

Optionally takes a working directory to run the command from.

The command is echoed if scriptlikeEcho is true.

  1. int tryRun(string command)
  2. int tryRun(Path workingDirectory, string command)
    int
    tryRun

Return Value

Type: int

The error level the process exited with. Or -1 upon failure to start the process.

Examples

1 Args cmd;
2 cmd ~= Path("some tool");
3 cmd ~= "-o";
4 cmd ~= Path(`dir/out file.txt`);
5 cmd ~= ["--abc", "--def", "-g"];
6 auto errLevel = Path("some working dir").run(cmd.data);

Meta