Function run

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.

ErrorLevelException is thrown if the process returns a non-zero error level. If you want to handle the error level yourself, use tryRun instead of run.

Prototypes

void run(
  string command
);

void run(
  Path workingDirectory,
  string command
);

Example

Args cmd;
cmd ~= Path("some tool");
cmd ~= "-o";
cmd ~= Path(`dir/out file.txt`);
cmd ~= ["--abc", "--def", "-g"];
Path("some working dir").run(cmd.data);

Authors

Nick Sabalausky

Copyright

Copyright (C) 2014-2015 Nick Sabalausky

License

zlib/libpng