Fix argument lexer in ProcessLogger, replace it with shlex standard python module.
--- a/util/ProcessLogger.py Tue Feb 20 11:34:28 2024 +0100
+++ b/util/ProcessLogger.py Tue Feb 20 11:37:54 2024 +0100
@@ -28,6 +28,7 @@
import subprocess
import ctypes
import time
+import shlex
from threading import Timer, Lock, Thread, Semaphore, Condition
import signal
@@ -82,16 +83,9 @@
self.logger = logger
if not isinstance(Command, list):
self.Command_str = Command
- self.Command = []
- for i, word in enumerate(Command.replace("'", '"').split('"')):
- if i % 2 == 0:
- word = word.strip()
- if len(word) > 0:
- self.Command.extend(word.split())
- else:
- self.Command.append(word)
- else:
- self.Command = [x if type(x)==str else x.decode() for x in Command]
+ self.Command = shlex.split(Command)
+ else:
+ self.Command = Command
self.Command_str = subprocess.list2cmdline(self.Command)
fsencoding = sys.getfilesystemencoding()