accounts: decode output of hooks
When a hook is configured, the output is a bytes object. This is then printed on the console/logfile as: 2020-10-12 08:36:17 INFO: Hook stdout: b'Processed 3 total files in almost no time.\nAdded 3 new messages to the database.\n' Hook stderr:b'' Decode the output so that it is printed nicely, as: 2020-10-12 08:36:17 INFO: Hook stdout: Processed 3 total files in almost no time. Added 3 new messages to the database. Hook stderr: Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
This commit is contained in:
parent
423785725b
commit
c00af91990
@ -459,8 +459,9 @@ class SyncableAccount(Account):
|
||||
p = Popen(cmd, shell=True,
|
||||
stdin=PIPE, stdout=PIPE, stderr=PIPE,
|
||||
close_fds=True)
|
||||
r = p.communicate()
|
||||
self.ui.callhook("Hook stdout: %s\nHook stderr:%s\n" % r)
|
||||
stdout, stderr = p.communicate()
|
||||
self.ui.callhook("Hook stdout: %s\nHook stderr:%s\n"
|
||||
% (stdout.decode('utf-8'), stderr.decode('utf-8')))
|
||||
self.ui.callhook("Hook return code: %d" % p.returncode)
|
||||
except (KeyboardInterrupt, SystemExit):
|
||||
raise
|
||||
|
Loading…
Reference in New Issue
Block a user