Mercurial > libervia-backend
comparison sat/tools/common/async_process.py @ 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 | 559a625a236b |
children | e86b71b1aa31 |
comparison
equal
deleted
inserted
replaced
3160:330a5f1d9eea | 3161:be5fffe34987 |
---|---|
85 | 85 |
86 msg = (_("Can't complete {name} command (error code: {code}):\n" | 86 msg = (_("Can't complete {name} command (error code: {code}):\n" |
87 "stderr:\n{stderr}\n{stdout}\n") | 87 "stderr:\n{stderr}\n{stdout}\n") |
88 .format(name = self.command_name, | 88 .format(name = self.command_name, |
89 code = reason.value.exitCode, | 89 code = reason.value.exitCode, |
90 stderr= err_data.encode('utf-8', 'replace'), | 90 stderr= err_data.decode(errors='replace'), |
91 stdout = "stdout: " + data.decode('utf-8', 'replace') | 91 stdout = "stdout: " + data.decode(errors='replace') |
92 if data else '', | 92 if data else '', |
93 )) | 93 )) |
94 self._deferred.errback(Failure(exceptions.CommandException( | 94 self._deferred.errback(Failure(exceptions.CommandException( |
95 msg, data, err_data))) | 95 msg, data, err_data))) |
96 | 96 |
135 reactor.spawnProcess(prot, | 135 reactor.spawnProcess(prot, |
136 command, | 136 command, |
137 cmd_args, | 137 cmd_args, |
138 **kwargs) | 138 **kwargs) |
139 return d | 139 return d |
140 | |
141 | |
142 run = CommandProtocol.run |