Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/general.py
diff options
context:
space:
mode:
authorAnton Hvornum <anton@hvornum.se>2021-05-12 10:58:46 +0000
committerGitHub <noreply@github.com>2021-05-12 10:58:46 +0000
commitdf6c4e77f721da2b03a510548d281992b25987b2 (patch)
treefc5556c89356cf19140c236d64ba34a368565e63 /archinstall/lib/general.py
parent0ef8cc579eba15803f542947c56a15ab9807b09c (diff)
parentaf3d65cc98632042b3b0ef62cfc27553261ec3b0 (diff)
Merge pull request #427 from advaithm/mypy
some type hint fixes and a bad catch fix
Diffstat (limited to 'archinstall/lib/general.py')
-rw-r--r--archinstall/lib/general.py9
1 files changed, 5 insertions, 4 deletions
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'