Skip to content

Commit

Permalink
Merge pull request #3 from rootifera/dev
Browse files Browse the repository at this point in the history
prints none found if there are no partitions to umount
  • Loading branch information
rootifera authored Jul 15, 2024
2 parents 3d445d0 + 4d4f512 commit 94d5a3b
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions diskforge.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ def identify_disks():


def unmount_disks_partitions(disks):
any_unmounted = False

for disk in disks:
try:
partitions_output = subprocess.check_output(
Expand All @@ -100,8 +102,6 @@ def unmount_disks_partitions(disks):
if not partitions:
continue

unmounted = False

for partition in partitions:
try:
mount_points = subprocess.check_output(
Expand All @@ -120,12 +120,15 @@ def unmount_disks_partitions(disks):
stderr=subprocess.DEVNULL
)
print(f"Unmounted {mount_point}")
unmounted = True
any_unmounted = True
except subprocess.CalledProcessError:
pass

except subprocess.CalledProcessError:
pass # outout gets too verbose if I print this one or the one above.
pass

if not any_unmounted:
print("None Found")


def verify_disk_partitions(disk):
Expand Down

0 comments on commit 94d5a3b

Please sign in to comment.