MCPcopy Index your code
hub / github.com/TCOTC/CleanFlash_Installer / RunProcess

Method RunProcess

CleanFlashCommon/ProcessUtils.cs:70–101  ·  view source on GitHub ↗
(ProcessStartInfo startInfo)

Source from the content-addressed store, hash-verified

68 }
69
70 public static ExitedProcess RunProcess(ProcessStartInfo startInfo)
71 {
72 startInfo.RedirectStandardOutput = true;
73 startInfo.RedirectStandardError = true;
74
75 StringBuilder outputBuilder = new StringBuilder();
76 Process process = new Process
77 {
78 StartInfo = startInfo
79 };
80 DataReceivedEventHandler outputHandler = new DataReceivedEventHandler(
81 delegate (object sender, DataReceivedEventArgs e) {
82 outputBuilder.AppendLine(e.Data);
83 }
84 );
85
86 process.OutputDataReceived += outputHandler;
87 process.ErrorDataReceived += outputHandler;
88
89 process.Start();
90 process.BeginOutputReadLine();
91 process.BeginErrorReadLine();
92 process.WaitForExit();
93 process.CancelOutputRead();
94 process.CancelErrorRead();
95
96 return new ExitedProcess
97 {
98 ExitCode = process.ExitCode,
99 Output = outputBuilder.ToString().Trim()
100 };
101 }
102
103 public static Process RunUnmanagedProcess(ProcessStartInfo startInfo)
104 {

Callers 3

RegisterActiveXMethod · 0.80
ApplyRegistryMethod · 0.80
UnregisterActiveXMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected