unmount_linux.go 349 B

1234567891011121314151617181920212223
  1. package fuse
  2. import (
  3. "bytes"
  4. "fmt"
  5. "os/exec"
  6. )
  7. func unmount(dir string) (err error) {
  8. // Call fusermount.
  9. cmd := exec.Command("fusermount", "-u", dir)
  10. output, err := cmd.CombinedOutput()
  11. if err != nil {
  12. if len(output) > 0 {
  13. output = bytes.TrimRight(output, "\n")
  14. err = fmt.Errorf("%v: %s", err, output)
  15. }
  16. return
  17. }
  18. return
  19. }