private InputCapableCliProcess StartProcess() { // Create process start info var startInfo = new ProcessStartInfo { FileName = _filePath, WorkingDirectory = _workingDirectory, Arguments = _arguments, StandardOutputEncoding = _standardOutputEncoding, StandardErrorEncoding = _standardErrorEncoding }; // Set environment variables #if NET45 foreach (var variable in _environmentVariables) { startInfo.EnvironmentVariables[variable.Key] = variable.Value; } #else foreach (var variable in _environmentVariables) { startInfo.Environment[variable.Key] = variable.Value; } #endif // Create and start process var process = new InputCapableCliProcess( startInfo, _standardOutputObserver, _standardErrorObserver, _standardOutputClosedObserver, _standardErrorClosedObserver ); process.Start(); return(process); }
/// <summary> /// Initializes an instance of <see cref="ExecutionResult"/> with given output data. /// </summary> public ExecutionResultWithRemainingInput(int exitCode, string standardOutput, string standardError, DateTimeOffset startTime, DateTimeOffset exitTime, InputCapableCliProcess process) : base(exitCode, standardOutput, standardError, startTime, exitTime) { _process = process; }