mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-08 10:54:15 +02:00
0.9.0
This commit is contained in:
@@ -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])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user