|
|
@ -204,13 +204,29 @@ public static class ProcessRunner |
|
|
|
|
|
|
|
|
|
|
|
await process.WaitForExitAsync().ConfigureAwait(false); |
|
|
|
await process.WaitForExitAsync().ConfigureAwait(false); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string? processName = null; |
|
|
|
|
|
|
|
TimeSpan elapsed = default; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Accessing these properties may throw an exception if the process has already exited |
|
|
|
|
|
|
|
try |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
processName = process.ProcessName; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
catch (SystemException) { } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
elapsed = process.ExitTime - process.StartTime; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
catch (SystemException) { } |
|
|
|
|
|
|
|
|
|
|
|
return new ProcessResult |
|
|
|
return new ProcessResult |
|
|
|
{ |
|
|
|
{ |
|
|
|
ExitCode = process.ExitCode, |
|
|
|
ExitCode = process.ExitCode, |
|
|
|
StandardOutput = stdout, |
|
|
|
StandardOutput = stdout, |
|
|
|
StandardError = stderr, |
|
|
|
StandardError = stderr, |
|
|
|
ProcessName = process.MachineName, |
|
|
|
ProcessName = processName, |
|
|
|
Elapsed = process.ExitTime - process.StartTime |
|
|
|
Elapsed = elapsed |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|