From ed650bace8ad0cd6becf77ac861bb48d622793be Mon Sep 17 00:00:00 2001 From: Ionite Date: Fri, 20 Oct 2023 19:22:51 -0400 Subject: [PATCH] Update PyVenvRunner.Run to accept ProcessArgs --- StabilityMatrix.Core/Python/PyVenvRunner.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/StabilityMatrix.Core/Python/PyVenvRunner.cs b/StabilityMatrix.Core/Python/PyVenvRunner.cs index 6bbabf14..0e7c7419 100644 --- a/StabilityMatrix.Core/Python/PyVenvRunner.cs +++ b/StabilityMatrix.Core/Python/PyVenvRunner.cs @@ -349,7 +349,7 @@ public class PyVenvRunner : IDisposable, IAsyncDisposable /// Run a command using the venv Python executable and return the result. /// /// Arguments to pass to the Python executable. - public async Task Run(string arguments) + public async Task Run(ProcessArgs arguments) { // Record output for errors var output = new StringBuilder(); @@ -381,12 +381,14 @@ public class PyVenvRunner : IDisposable, IAsyncDisposable [MemberNotNull(nameof(Process))] public void RunDetached( - string arguments, + ProcessArgs args, Action? outputDataReceived, Action? onExit = null, bool unbuffered = true ) { + var arguments = args.ToString(); + if (!PythonPath.Exists) { throw new FileNotFoundException("Venv python not found", PythonPath); @@ -395,10 +397,10 @@ public class PyVenvRunner : IDisposable, IAsyncDisposable Logger.Info( "Launching venv process [{PythonPath}] " - + "in working directory [{WorkingDirectory}] with args {arguments.ToRepr()}", + + "in working directory [{WorkingDirectory}] with args {Arguments}", PythonPath, WorkingDirectory, - arguments.ToRepr() + arguments ); var filteredOutput =