This commit is contained in:
Vinícius Moreira
2020-04-13 11:49:28 -03:00
parent 83aab1ff55
commit 01a60ea686
165 changed files with 12778 additions and 6171 deletions

View File

@@ -106,7 +106,7 @@ class ProcessHandler:
if self.watcher:
self.watcher.print(msg)
def handle(self, process: SystemProcess, error_output: StringIO = None) -> bool:
def handle(self, process: SystemProcess, error_output: StringIO = None, output_handler=None) -> bool:
self._notify_watcher(' '.join(process.subproc.args) + '\n')
already_succeeded = False
@@ -117,6 +117,9 @@ class ProcessHandler:
if line:
self._notify_watcher(line)
if output_handler:
output_handler(line)
if process.success_phrases and [p in line for p in process.success_phrases]:
already_succeeded = True
@@ -132,6 +135,9 @@ class ProcessHandler:
if line:
self._notify_watcher(line)
if output_handler:
output_handler(line)
if error_output is not None:
error_output.write(line)
@@ -241,6 +247,10 @@ def get_dir_size(start_path='.'):
def get_human_size_str(size) -> str:
int_size = int(size)
if int_size == 0:
return '0'
for m in SIZE_MULTIPLIERS:
size_str = str(int_size * m[0])