未验证 提交 a03fb8fd 编写于 作者: C chnliyong 提交者: GitHub

use fusermount to unmount on linux (#242)

* use fusermount to unmount on linux

* fallback to umount when fusermount doesnot exist: go-fuse direct mount doesnot rely on fusermount
上级 bded7342
......@@ -101,7 +101,11 @@ func installHandler(mp string) {
<-signalChan
go func() {
if runtime.GOOS == "linux" {
_ = exec.Command("umount", mp, "-l").Run()
if _, err := exec.LookPath("fusermount"); err == nil {
_ = exec.Command("fusermount", "-uz", mp).Run()
} else {
_ = exec.Command("umount", "-l", mp).Run()
}
} else if runtime.GOOS == "darwin" {
_ = exec.Command("diskutil", "umount", "force", mp).Run()
}
......
......@@ -58,10 +58,18 @@ func umount(ctx *cli.Context) error {
cmd = exec.Command("diskutil", "umount", mp)
}
case "linux":
if force {
cmd = exec.Command("umount", "-l", mp)
if _, err := exec.LookPath("fusermount"); err == nil {
if force {
cmd = exec.Command("fusermount", "-uz", mp)
} else {
cmd = exec.Command("fusermount", "-u", mp)
}
} else {
cmd = exec.Command("umount", mp)
if force {
cmd = exec.Command("umount", "-l", mp)
} else {
cmd = exec.Command("umount", mp)
}
}
case "windows":
if !force {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册