main: don't attempt lazy unmount on MacOSX

This commit is contained in:
Jakob Unterwurzacher 2017-02-15 23:20:41 +01:00
parent 6ac9dcaae0
commit bef27305bc
1 changed files with 9 additions and 5 deletions

View File

@ -9,6 +9,7 @@ import (
"os/exec"
"os/signal"
"path/filepath"
"runtime"
"strings"
"syscall"
"time"
@ -291,11 +292,14 @@ func handleSigint(srv *fuse.Server, mountpoint string) {
err := srv.Unmount()
if err != nil {
tlog.Warn.Print(err)
tlog.Info.Printf("Trying lazy unmount")
cmd := exec.Command("fusermount", "-u", "-z", mountpoint)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
cmd.Run()
if runtime.GOOS == "linux" {
// MacOSX does not support lazy unmount
tlog.Info.Printf("Trying lazy unmount")
cmd := exec.Command("fusermount", "-u", "-z", mountpoint)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
cmd.Run()
}
}
os.Exit(1)
}()