From 283606c2801c1be515115478642918358efddf3c Mon Sep 17 00:00:00 2001 From: Glenn Date: Mon, 20 Nov 2023 12:37:31 +0100 Subject: [PATCH] fix: handle 'fusermount -u' return codes --- src/filesystems/filesystem.cr | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/filesystems/filesystem.cr b/src/filesystems/filesystem.cr index b5cf44d..da6090d 100644 --- a/src/filesystems/filesystem.cr +++ b/src/filesystems/filesystem.cr @@ -21,7 +21,13 @@ module GX module GenericFilesystem def unmount system("fusermount -u #{mount_dir.shellescape}") - puts "Filesystem #{name} is now closed.".colorize(:green) + fusermount_status = $? + + if fusermount_status.success? == 0 + puts "Filesystem #{name} is now closed.".colorize(:green) + else + puts "Error: Unable to unmount filesystem #{name} (exit code: #{fusermount_status.exit_code}).".colorize(:red) + end end def mount(&block)