public static int Command(string command, string arguments) { ConsoleProcess proc = new ConsoleProcess(); proc.Arguments = arguments; proc.AppFileName = command; proc.Start(); proc.Wait(); return proc.ExitCode; }
public static int Command(string command, string arguments) { ConsoleProcess proc = new ConsoleProcess(); proc.Arguments = arguments; proc.AppFileName = command; proc.Start(); proc.Wait(); return(proc.ExitCode); }
public static int Command(string command, string arguments, IList<string> stdoutAndErr) { ConsoleProcess proc = new ConsoleProcess(); proc.Arguments = arguments; proc.AppFileName = command; proc.StderrLineRead += l => { lock (stdoutAndErr) stdoutAndErr.Add(l); }; proc.StdoutLineRead += l => { lock (stdoutAndErr) stdoutAndErr.Add(l); }; proc.Start(); proc.Wait(); return proc.ExitCode; }
public static int Command(string command, string arguments, IList <string> stdoutAndErr) { ConsoleProcess proc = new ConsoleProcess(); proc.Arguments = arguments; proc.AppFileName = command; proc.StderrLineRead += l => { lock (stdoutAndErr) stdoutAndErr.Add(l); }; proc.StdoutLineRead += l => { lock (stdoutAndErr) stdoutAndErr.Add(l); }; proc.Start(); proc.Wait(); return(proc.ExitCode); }