package ru.serce.jnrfuse.utils;

import ru.serce.jnrfuse.FuseException;

import java.io.IOException;
import java.nio.file.Path;


public class MountUtils {
    /**
     * Perform/force a umount at the provided Path
     */
    public static void umount(Path mountPoint) {
        try {
            String mountPath = mountPoint.toAbsolutePath().toString();
            try {
                new ProcessBuilder("fusermount", "-u", "-z", mountPath).start();
            } catch (IOException e) {
                try {
                    new ProcessBuilder("umount", mountPath).start().waitFor();
                } catch (InterruptedException e1) {
                    e1.printStackTrace();
                }
            }
        } catch (IOException e) {
            throw new FuseException("Unable to umount FS", e);
        }
    }
}

@@ -265,34 +265,16 @@
 oint) %7B%0A
-        try %7B%0A    
         
@@ -332,36 +332,32 @@
 ring();%0A        
-    
 try %7B%0A          
@@ -350,36 +350,32 @@
 y %7B%0A            
-  
-  
 new ProcessBuild
@@ -423,36 +423,32 @@
 tart();%0A        
-    
 %7D catch (IOExcep
@@ -465,28 +465,24 @@
             
-    
 try %7B%0A      
@@ -483,36 +483,32 @@
                 
-  
-  
 new ProcessBuild
@@ -558,28 +558,24 @@
             
-    
 %7D catch (Int
@@ -592,18 +592,18 @@
 ception 
+i
 e
-1
 ) %7B%0A    
@@ -618,66 +618,115 @@
     
-    
-e1.printStackTrace();%0A                %7D%0A        
+Thread.currentThread().interrupt();%0A                throw new FuseException(%22Unable to umount FS%22, e);%0A
     
-%7D%0A
     
@@ -742,37 +742,81 @@
 ch (IOException 
+io
 e) %7B%0A
+                ioe.addSuppressed(e);%0A    
             thro
@@ -850,36 +850,52 @@
  to umount FS%22, 
+io
 e);%0A
+            %7D%0A
         %7D%0A    %7D%0A

Remove improper error handling