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:
authorDaniel Girtler <blackrabbit256@gmail.com>2023-10-02 21:01:23 +1100
committerGitHub <noreply@github.com>2023-10-02 21:01:23 +1100
commit5c903df55fac449baae1e9cc23b04f6beeb55364 (patch)
treee9715ce5f82b57a34d9b0726973187730bca8cb0 /archinstall/lib/general.py
parenta095e393d8517e99f8832c447fd2ef0902cb6ca6 (diff)
Simplify SysCommand decoding (#2121)
Diffstat (limited to 'archinstall/lib/general.py')
-rw-r--r--archinstall/lib/general.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/archinstall/lib/general.py b/archinstall/lib/general.py
index 71981fb6..3697cf2d 100644
--- a/archinstall/lib/general.py
+++ b/archinstall/lib/general.py
@@ -430,10 +430,15 @@ class SysCommand:
return True
- def decode(self, *args, **kwargs) -> Optional[str]:
- if self.session:
- return self.session._trace_log.decode(*args, **kwargs)
- return None
+ def decode(self, encoding: str = 'utf-8', errors='backslashreplace', strip: bool = True) -> str:
+ if not self.session:
+ raise ValueError('No session available to decode')
+
+ val = self.session._trace_log.decode(encoding, errors=errors)
+
+ if strip:
+ return val.strip()
+ return val
@property
def exit_code(self) -> Optional[int]: