Skip to content

Commit 85e4960

Browse files
authored
Merge pull request #361 from ionite34/fix-process-error
Fix process errors on platforms not supporting name or start time reports
2 parents baf9458 + 7c4ab81 commit 85e4960

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ All notable changes to Stability Matrix will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning 2.0](https://semver.org/spec/v2.0.0.html).
77

8+
## v2.6.3
9+
### Fixed
10+
- Fixed InvalidOperationException during prerequisite installs on certain platforms where process name and duration reporting are not supported
11+
812
## v2.6.2
913
### Changed
1014
- Backend changes for auto-update schema v3, supporting customizable release channels and faster downloads with zip compression

StabilityMatrix.Core/Processes/ProcessRunner.cs

+18-2
Original file line numberDiff line numberDiff line change
@@ -204,13 +204,29 @@ public static async Task<ProcessResult> GetProcessResultAsync(
204204

205205
await process.WaitForExitAsync().ConfigureAwait(false);
206206

207+
string? processName = null;
208+
TimeSpan elapsed = default;
209+
210+
// Accessing these properties may throw an exception if the process has already exited
211+
try
212+
{
213+
processName = process.ProcessName;
214+
}
215+
catch (SystemException) { }
216+
217+
try
218+
{
219+
elapsed = process.ExitTime - process.StartTime;
220+
}
221+
catch (SystemException) { }
222+
207223
return new ProcessResult
208224
{
209225
ExitCode = process.ExitCode,
210226
StandardOutput = stdout,
211227
StandardError = stderr,
212-
ProcessName = process.MachineName,
213-
Elapsed = process.ExitTime - process.StartTime
228+
ProcessName = processName,
229+
Elapsed = elapsed
214230
};
215231
}
216232

0 commit comments

Comments
 (0)