Commit d1c58d69 authored by Aaron Jacobs's avatar Aaron Jacobs

Don't depend on fuseshim for unmounting.

parents 2ed9350a c7738d6d
......@@ -14,10 +14,8 @@
package fuse
import "github.com/jacobsa/fuse/internal/fuseshim"
// Attempt to unmount the file system whose mount point is the supplied
// directory.
func Unmount(dir string) error {
return fuseshim.Unmount(dir)
return unmount(dir)
}
package fuseshim
import (
"bytes"
"fmt"
"os/exec"
)
func unmount(dir string) (err error) {
// Call fusermount.
cmd := exec.Command("fusermount", "-u", dir)
output, err := cmd.CombinedOutput()
if err != nil {
if len(output) > 0 {
output = bytes.TrimRight(output, "\n")
err = fmt.Errorf("%v: %s", err, output)
}
return
}
return
}
// +build !linux
package fuse
import (
"os"
"syscall"
)
func unmount(dir string) (err error) {
err = syscall.Unmount(dir, 0)
if err != nil {
err = &os.PathError{Op: "unmount", Path: dir, Err: err}
return
}
return
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment