Browse Source

Fix unbuffered mode insertion

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

15
StabilityMatrix.Core/Python/PyVenvRunner.cs

@ -195,8 +195,19 @@ public class PyVenvRunner : IDisposable
{
{"PYTHONUNBUFFERED", "1"}
};
Process = ProcessRunner.StartProcess(PythonPath, "-u " + arguments, workingDirectory, filteredOutput,
env);
// If arguments starts with -, it's a flag, insert `u` after it for unbuffered mode
if (arguments.StartsWith('-'))
{
arguments = arguments.Insert(1, "u");
}
// Otherwise insert -u at the beginning
else
{
arguments = "-u " + arguments;
}
Process = ProcessRunner.StartProcess(PythonPath, arguments, workingDirectory, filteredOutput, env);
}
else
{

Loading…
Cancel
Save