You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
362 B

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