tools (common/async_process): fixed stderr handling + added global "run"

This commit is contained in:
Goffi 2020-02-09 23:56:40 +01:00
commit bc3abd6920

View file

@ -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