From 69d079e63a00caf9268575a6ca4789962776761b Mon Sep 17 00:00:00 2001 From: advaithm Date: Wed, 12 May 2021 15:45:45 +0530 Subject: some type hint fixes and a bad catch fix --- archinstall/lib/general.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'archinstall/lib/general.py') diff --git a/archinstall/lib/general.py b/archinstall/lib/general.py index eb0c5d14..72f8677f 100644 --- a/archinstall/lib/general.py +++ b/archinstall/lib/general.py @@ -5,6 +5,7 @@ from subprocess import Popen, STDOUT, PIPE, check_output from select import epoll, EPOLLIN, EPOLLHUP from .exceptions import * from .output import log +from typing import Optional, Union def gen_uid(entropy_length=256): return hashlib.sha512(os.urandom(entropy_length)).hexdigest() @@ -160,16 +161,15 @@ class sys_command():#Thread): 'exit_code': self.exit_code } - def peak(self, output :str): + def peak(self, output : Union[str, bytes]) -> bool: if type(output) == bytes: try: output = output.decode('UTF-8') except UnicodeDecodeError: - return None - + return False output = output.strip('\r\n ') if len(output) <= 0: - return None + return False if self.peak_output: from .user_interaction import get_terminal_width @@ -191,6 +191,7 @@ class sys_command():#Thread): # And print the new output we're peaking on: sys.stdout.write(output) sys.stdout.flush() + return True def run(self): self.status = 'running' -- cgit v1.2.3-70-g09d2