changeset 3161:be5fffe34987

tools (common/async_process): fixed stderr handling + added global "run"
author Goffi <goffi@goffi.org>
date Sun, 09 Feb 2020 23:56:40 +0100
parents 330a5f1d9eea
children b5c058c7692e
files sat/tools/common/async_process.py
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/sat/tools/common/async_process.py	Sun Feb 09 23:50:26 2020 +0100
+++ b/sat/tools/common/async_process.py	Sun Feb 09 23:56:40 2020 +0100
@@ -87,8 +87,8 @@
                      "stderr:\n{stderr}\n{stdout}\n")
                    .format(name = self.command_name,
                            code = reason.value.exitCode,
-                           stderr= err_data.encode('utf-8', 'replace'),
-                           stdout = "stdout: " + data.decode('utf-8', 'replace')
+                           stderr= err_data.decode(errors='replace'),
+                           stdout = "stdout: " + data.decode(errors='replace')
                                     if data else '',
                            ))
             self._deferred.errback(Failure(exceptions.CommandException(
@@ -137,3 +137,6 @@
                              cmd_args,
                              **kwargs)
         return d
+
+
+run = CommandProtocol.run