diff sat/tools/common/async_process.py @ 3040:fee60f17ebac

jp: jp asyncio port: /!\ this commit is huge. Jp is temporarily not working with `dbus` bridge /!\ This patch implements the port of jp to asyncio, so it is now correctly using the bridge asynchronously, and it can be used with bridges like `pb`. This also simplify the code, notably for things which were previously implemented with many callbacks (like pagination with RSM). During the process, some behaviours have been modified/fixed, in jp and backends, check diff for details.
author Goffi <goffi@goffi.org>
date Wed, 25 Sep 2019 08:56:41 +0200
parents 0d55a52056f7
children 9d0df638c8b4
line wrap: on
line diff
--- a/sat/tools/common/async_process.py	Wed Sep 25 08:53:38 2019 +0200
+++ b/sat/tools/common/async_process.py	Wed Sep 25 08:56:41 2019 +0200
@@ -76,8 +76,7 @@
     def processEnded(self, reason):
         data = b''.join(self.data)
         if (reason.value.exitCode == 0):
-            log.debug(_('{name!r} command succeed').format(
-                name=self.command_name.decode('utf-8', 'ignore')))
+            log.debug(_(f'{self.command_name!r} command succeed'))
             # we don't use "replace" on purpose, we want an exception if decoding
             # is not working properly
             self._deferred.callback(data)
@@ -106,7 +105,7 @@
             - stdin(unicode, None): data to push to standard input
             - verbose(bool): if True stdout and stderr will be logged
             other keyword arguments will be used in reactor.spawnProcess
-        @return ((D)): stdout in case of success
+        @return ((D)bytes): stdout in case of success
         @raise RuntimeError: command returned a non zero status
             stdin and stdout will be given as arguments
 
@@ -115,8 +114,6 @@
         if stdin is not None:
             stdin = stdin.encode('utf-8')
         verbose = kwargs.pop('verbose', False)
-        if 'path' in kwargs:
-            kwargs['path'] = kwargs['path'].encode('utf-8')
         args = [a.encode('utf-8') for a in args]
         kwargs = {k:v.encode('utf-8') for k,v in list(kwargs.items())}
         d = defer.Deferred()