Skip to content

Commit

Permalink
Executor: Don't use Process.ExitCode, unless the process has exited (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
radical authored Mar 18, 2022
1 parent 1d34f85 commit 01ead56
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/BenchmarkDotNet/Toolchains/Executor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,12 @@ private ExecuteResult Execute(Process process, BenchmarkCase benchmarkCase, Sync
if (loggerWithDiagnoser.LinesWithResults.Any(line => line.Contains("BadImageFormatException")))
logger.WriteLineError("You are probably missing <PlatformTarget>AnyCPU</PlatformTarget> in your .csproj file.");

return new ExecuteResult(true, process.ExitCode, process.Id, loggerWithDiagnoser.LinesWithResults, loggerWithDiagnoser.LinesWithExtraOutput, launchIndex);
return new ExecuteResult(true,
process.HasExited ? process.ExitCode : null,
process.Id,
loggerWithDiagnoser.LinesWithResults,
loggerWithDiagnoser.LinesWithExtraOutput,
launchIndex);
}

private ProcessStartInfo CreateStartInfo(BenchmarkCase benchmarkCase, ArtifactsPaths artifactsPaths, string args, IResolver resolver)
Expand Down

0 comments on commit 01ead56

Please sign in to comment.