From bc3abd6920f48f82ee2eb2057f3b80e96d224a2b Mon Sep 17 00:00:00 2001 From: Goffi Date: Sun, 9 Feb 2020 23:56:40 +0100 Subject: [PATCH] tools (common/async_process): fixed stderr handling + added global "run" --- sat/tools/common/async_process.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sat/tools/common/async_process.py b/sat/tools/common/async_process.py index 0f9512bf..204ee18e 100644 --- a/sat/tools/common/async_process.py +++ b/sat/tools/common/async_process.py @@ -87,8 +87,8 @@ class CommandProtocol(protocol.ProcessProtocol): "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 @@ class CommandProtocol(protocol.ProcessProtocol): cmd_args, **kwargs) return d + + +run = CommandProtocol.run