From 0bdd46d11026685df4b81f5841e6ce2b4398f2db Mon Sep 17 00:00:00 2001 From: ionite34 Date: Tue, 2 Jan 2024 00:34:17 +0800 Subject: [PATCH] Add EnsureSuccessExitCode for ProcessResult tasks --- StabilityMatrix.Core/Processes/ProcessResult.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/StabilityMatrix.Core/Processes/ProcessResult.cs b/StabilityMatrix.Core/Processes/ProcessResult.cs index 9fca6171..509f7ab1 100644 --- a/StabilityMatrix.Core/Processes/ProcessResult.cs +++ b/StabilityMatrix.Core/Processes/ProcessResult.cs @@ -22,3 +22,13 @@ public readonly record struct ProcessResult } } } + +public static class ProcessResultTaskExtensions +{ + public static async Task EnsureSuccessExitCode(this Task task) + { + var result = await task.ConfigureAwait(false); + result.EnsureSuccessExitCode(); + return result; + } +}