From d2804993dbcd9fc6ff743d2886000407ec3b019e Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sun, 14 Mar 2021 12:24:37 +0100 Subject: Added some error handling for umount(). --- archinstall/lib/disk.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'archinstall/lib') diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py index 16756df8..54f86f7a 100644 --- a/archinstall/lib/disk.py +++ b/archinstall/lib/disk.py @@ -313,9 +313,19 @@ class Partition(): return True def unmount(self): - if sys_command(f'/usr/bin/umount {self.path}').exit_code == 0: - self.mountpoint = None - return True + try: + exit_code = sys_command(f'/usr/bin/umount {self.path}').exit_code + except SysCallError as err: + exit_code = err.exit_code + + # Without to much research, it seams that low error codes are errors. + # And above 8k is indicators such as "/dev/x not mounted.". + # So anything in between 0 and 8k are errors (?). + if exit_code > 0 and exit_code < 8000: + raise err + + self.mountpoint = None + return True def filesystem_supported(self): """ -- cgit v1.2.3-70-g09d2