changeset 3660:e584ce33ef1d

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). (grafted from 25cbaf04772855cd8aead18771465a4f00f5fa03)
author Goffi <goffi@goffi.org>
date Thu, 29 Jul 2021 22:51:01 +0200 (2021-07-29)
parents d4b8f1e8f0b4
children 0661b2aac167
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	Wed Sep 08 11:18: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,