public ProcessOutput Exec(string commandName, string commandArgs, IShellLogger overridingShellLogger = null) { var stringLogger = new StringShellLogger(); var logger = new MultiShellLogger(overridingShellLogger ?? new ConsoleShellLogger(), stringLogger); var exitCode = Execute(commandName, commandArgs, logger); if (exitCode != 0) { throw new CommandExecutionException(String.Format("running: {0} {1}\nin: {2}\nexited with {3}", commandName, commandArgs, Directory.GetCurrentDirectory(), exitCode), stringLogger.ErrorAndOutput, exitCode); } return new ProcessOutput { ExitCode = exitCode, Error = stringLogger.Error, Output = stringLogger.Output, ErrorAndOutput = stringLogger.ErrorAndOutput }; }
public ProcessOutput Exec(string commandName, string commandArgs, IShellLogger overridingShellLogger = null) { var stringLogger = new StringShellLogger(); var logger = new MultiShellLogger(overridingShellLogger ?? new ConsoleShellLogger(), stringLogger); var exitCode = Execute(commandName, commandArgs, logger); if (exitCode != 0) { throw new CommandExecutionException(String.Format("running: {0} {1}\nin: {2}\nexited with {3}", commandName, commandArgs, Directory.GetCurrentDirectory(), exitCode), stringLogger.ErrorAndOutput, exitCode); } return(new ProcessOutput { ExitCode = exitCode, Error = stringLogger.Error, Output = stringLogger.Output, ErrorAndOutput = stringLogger.ErrorAndOutput }); }