Added a new feature: on_output in sys_command. Passing a on_output function to sys_command forces it to send each output block to the callback. Useful to create progressbars etc.

This commit is contained in:
Anton Hvornum 2020-03-15 19:05:55 +00:00
parent 93780ba888
commit 3c0963a0a1
1 changed files with 3 additions and 0 deletions

View File

@ -313,6 +313,9 @@ class sys_command():#Thread):
print(self.cmd[0], 'gave:', output.decode('UTF-8'))
log(self.cmd[0],'gave:', output.decode('UTF-8'), origin='spawn', level=4)
if 'on_output' in self.kwargs:
self.kwargs['on_output'](self, output)
lower = output.lower()
broke = False
if 'events' in self.kwargs: