changeset 3603:25cbaf047728

tools (common/async_process): remove useless encoding + use full path for command: - arguments don't need to be encoded anymore, `spawnProcess` handles str directly now - use full path even for first argument: even if first argument should be only executable name, it appears that using full path only in `command` is not enough (seen with Python where system installation is used instead of the VirtualEnv one when full path is not used as first argument).
author Goffi <goffi@goffi.org>
date Thu, 29 Jul 2021 22:51:01 +0200 (2021-07-29)
parents 7241ce3b79dd
children 80815f2f12cf
files sat/tools/common/async_process.py
diffstat 1 files changed, 2 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/sat/tools/common/async_process.py	Thu Jul 29 22:51:01 2021 +0200
+++ b/sat/tools/common/async_process.py	Thu Jul 29 22:51:01 2021 +0200
@@ -114,8 +114,7 @@
         if stdin is not None:
             stdin = stdin.encode('utf-8')
         verbose = kwargs.pop('verbose', False)
-        args = [a.encode('utf-8') for a in args]
-        kwargs = {k:v.encode('utf-8') for k,v in list(kwargs.items())}
+        args = list(args)
         d = defer.Deferred()
         prot = cls(d, stdin=stdin)
         if verbose:
@@ -131,7 +130,7 @@
                 prot.name = name
         else:
             command = cls.command
-        cmd_args = [os.path.basename(command)] + args
+        cmd_args = [command] + args
         reactor.spawnProcess(prot,
                              command,
                              cmd_args,