private void runCommand(string[] arguments) { var command = "oi"; var args = ""; var index = 1; if (arguments.Length > 1 && arguments[1] == "oi") index = 2; else args = arguments[0]; for (int i = index; i < arguments.Length; i++) { if (args.Length > 0) args += " "; args += "\"" + arguments[i] + "\""; } var output = new List<string>(); var proc = new Process(); try { string[] errors; foreach (var line in proc.QueryAll(command, args + " --raw", false, _token, out errors)) { Logger.Write("line is " + line); _dispatch(line); } if (errors.Length > 0 && errors[0].Trim() != "") { foreach (var line in errors) _dispatch("error|" + line); } } catch (Exception ex) { Logger.Write(ex); } }
private void runCommand(string command, bool listenForFeedback) { log(string.Format("Running: oi {0}, listenForFeedback={1} in {2}", command, listenForFeedback, _testRunLocation)); var process = new Process(); string[] errors; var lines = process .QueryAll( "oi", command, false, _testRunLocation, out errors); if (errors.Any(x => x.Trim().Length > 0)) { foreach (var error in errors) handleFeedback(null, true, error); } foreach (var line in lines) { _outputs.Add(line); } log("Process exited"); }