fusego/unmount_linux.go

26 lines
398 B
Go
Raw Permalink Normal View History

2015-07-24 09:22:33 +03:00
package fuse
2015-07-24 09:20:11 +03:00
import (
"bytes"
2015-07-24 09:21:58 +03:00
"fmt"
2015-07-24 09:20:11 +03:00
"os/exec"
)
func unmount(dir string) error {
fusermount, err := findFusermount()
if err != nil {
return err
}
cmd := exec.Command(fusermount, "-u", dir)
2015-07-24 09:20:11 +03:00
output, err := cmd.CombinedOutput()
if err != nil {
if len(output) > 0 {
output = bytes.TrimRight(output, "\n")
return fmt.Errorf("%v: %s", err, output)
2015-07-24 09:20:11 +03:00
}
2015-07-24 09:21:58 +03:00
return err
2015-07-24 09:20:11 +03:00
}
return nil
2015-07-24 09:20:11 +03:00
}