/// <summary> /// Executes the specified program with the specified arguments. You can also /// specify the working directory of the command by providing the hash option "WorkingDir" /// </summary> /// <param name="command"> /// The command to execute /// </param> /// <param name="args">Additional args</param> /// <param name="options"> /// A hash of options to set on the process (like WorkingDir) /// </param> public static void exec(string command, string args, Hash options) { Exec exec = new Exec(); exec.ExeName = command; exec.Output = (options.ContainsKey("Output")) ? new FileInfo(options.ObtainAndRemove("Output", "")) : null; exec.Execute(args, options); //string workingDir = options.ObtainAndRemove("WorkingDir", "."); //bool ignoreNonZeroExitCode = options.ObtainAndRemove("IgnoreNonZeroExitCode", false); //var psi = new ProcessStartInfo(command, args) { // WorkingDirectory = workingDir, // UseShellExecute = false, // RedirectStandardError = true //}; //var process = Process.Start(psi); //process.WaitForExit(); //var exitCode = process.ExitCode; //if (exitCode != 0 && ignoreNonZeroExitCode == false) { // var errortext = process.StandardError.ReadAllAsString(); // throw new ExecutionFailedException(exitCode, errortext); //} }