26 namespace Ntp.Common.IO
32 this.command = command;
33 this.arguments = arguments;
35 ErrorMessage = message;
42 public static string WorkingDirectory {
get;
set; }
44 public string ErrorMessage {
get;
set; }
48 var proc =
new global::System.Diagnostics.Process
50 EnableRaisingEvents =
false,
53 UseShellExecute =
false,
54 RedirectStandardOutput =
true,
55 RedirectStandardError =
true,
56 WorkingDirectory = WorkingDirectory,
58 Arguments = $
" {arguments}" 63 log.ShellCommandExecuting(command, arguments);
68 error = proc.StandardError.ReadToEnd().Replace(Environment.NewLine,
" ");
73 log.WriteLine(e.Message,
Severity.Warn);
77 if (error ==
string.Empty)
78 return proc.StandardOutput;
80 log.ShellCommandError(ErrorMessage, error);
ShellCommand(string command, string arguments, LogBase log, string message)
readonly string arguments