Retry unmounting
This commit is contained in:
parent
f72e786efa
commit
a79006dc41
@ -102,26 +102,30 @@ class OverlayFSMount:
|
||||
self._mounted = True
|
||||
return self.mount_path
|
||||
|
||||
def unmount(self):
|
||||
def unmount(self) -> bool:
|
||||
if self._mounted:
|
||||
print("Unmounting...")
|
||||
|
||||
# Remove the mount
|
||||
if LMMConfig.use_fuse:
|
||||
run_cmd(
|
||||
returncode = run_cmd(
|
||||
[
|
||||
LMMConfig.fusermount_command,
|
||||
"-u",
|
||||
str(self.mount_path),
|
||||
]
|
||||
)
|
||||
) == 0
|
||||
else:
|
||||
run_sudo_cmd(
|
||||
returncode = run_sudo_cmd(
|
||||
[
|
||||
"umount",
|
||||
str(self.mount_path),
|
||||
]
|
||||
)
|
||||
|
||||
if returncode != 0:
|
||||
print("Unmounting failed")
|
||||
return False
|
||||
|
||||
# Remove the temporary workdir
|
||||
if self.workdir is not None:
|
||||
@ -132,6 +136,7 @@ class OverlayFSMount:
|
||||
print(f"Failed to clean temporary directory {self.workdir.name}")
|
||||
|
||||
self._mounted = False
|
||||
return True
|
||||
|
||||
def __del__(self):
|
||||
self.unmount()
|
||||
|
Loading…
Reference in New Issue
Block a user