Browse Source

Add logging of pip update in updates

pull/121/head
Ionite 1 year ago
parent
commit
f9a5f8ab3d
No known key found for this signature in database
  1. 16
      StabilityMatrix.Core/Python/PyVenvRunner.cs

16
StabilityMatrix.Core/Python/PyVenvRunner.cs

@ -201,16 +201,13 @@ public class PyVenvRunner : IDisposable, IAsyncDisposable
// Record output for errors
var output = new StringBuilder();
var outputAction =
outputDataReceived == null
? null
: new Action<ProcessOutput>(s =>
var outputAction = new Action<ProcessOutput>(s =>
{
Logger.Debug($"Pip output: {s.Text}");
// Record to output
output.Append(s.Text);
// Forward to callback
outputDataReceived(s);
outputDataReceived?.Invoke(s);
});
SetPyvenvCfg(PyRunner.PythonDir);
@ -427,10 +424,19 @@ public class PyVenvRunner : IDisposable, IAsyncDisposable
if (Process is { HasExited: false })
{
Process.Kill();
try
{
await Process
.WaitForExitAsync(new CancellationTokenSource(1000).Token)
.ConfigureAwait(false);
}
catch (OperationCanceledException e)
{
Logger.Error(e, "Venv Process did not exit in time in DisposeAsync");
Process.CancelStreamReaders();
}
}
Process = null;
GC.SuppressFinalize(this);

Loading…
Cancel
Save