13 public async ValueTask<ExternalSolverProcessProbeResult>
RunAsync(
14 string executablePath,
15 IEnumerable<string> arguments,
16 CancellationToken cancellationToken =
default)
18 ArgumentException.ThrowIfNullOrWhiteSpace(executablePath);
19 ArgumentNullException.ThrowIfNull(arguments);
24 FileName = executablePath,
26 Path.GetDirectoryName(executablePath) ??
27 Environment.CurrentDirectory,
28 UseShellExecute =
false,
29 RedirectStandardOutput =
true,
30 RedirectStandardError =
true,
34 foreach (
string argument
in arguments)
36 startInfo.ArgumentList.Add(argument);
42 StartInfo = startInfo,
43 EnableRaisingEvents =
true
50 throw new InvalidOperationException(
51 $
"Unable to start '{executablePath}'.");
54 Task<string> stdoutTask =
55 process.StandardOutput.ReadToEndAsync(
58 Task<string> stderrTask =
59 process.StandardError.ReadToEndAsync(
64 await process.WaitForExitAsync(
67 catch (OperationCanceledException)
84 catch (OperationCanceledException)