public void Execute(string program, string arguments) { var instructions = new ProcessInstructions { Program = program, Arguments = arguments }; if (_executor.ProcessInstance == null) _executor.ProcessInstance = _processFactory.Create(instructions); _executor.Execute(); }
public void Execute(string program, string arguments) { var instructions = new ProcessInstructions { Program = program, Arguments = arguments }; if (_executor.ProcessInstance == null) { _executor.ProcessInstance = _processFactory.Create(instructions); } _executor.Execute(); }
public void Execute(string program, string arguments, Func<string, bool> failurePredicate) { var instruction = new ProcessInstructions { Program = program, Arguments = arguments }; if (_executor.ProcessInstance == null) _executor.ProcessInstance = _processFactory.Create(instruction); _executor.Execute(); if (!WaitForExit()) throw new ProcessFailiureException(instruction, _executor.Output); if (failurePredicate(_executor.Output)) throw new ProcessFailiureException(instruction, _executor.Output); }
private static string FormatMessage(ProcessInstructions instructions, string output) { return $"{instructions.Program} with arguments: {instructions.Arguments} failed." + $"{Environment.NewLine} " + $"{output}"; }
public ProcessFailiureException(ProcessInstructions instructions, string output) : base(FormatMessage(instructions,output)) { }
public ProcessFailiureException(ProcessInstructions instructions) : this(instructions, string.Empty) { }