Copied some missing files from from jacobsa/bazilfuse@b378951.

geesefs-0-30-9
Aaron Jacobs 2015-07-23 16:22:49 +10:00
parent b8bf3cacb4
commit 38685c9ea2
3 changed files with 44 additions and 0 deletions

View File

@ -0,0 +1,6 @@
package bazilfuse
// Unmount tries to unmount the filesystem mounted at dir.
func Unmount(dir string) error {
return unmount(dir)
}

View File

@ -0,0 +1,21 @@
package bazilfuse
import (
"bytes"
"errors"
"os/exec"
)
func unmount(dir string) error {
cmd := exec.Command("fusermount", "-u", dir)
output, err := cmd.CombinedOutput()
if err != nil {
if len(output) > 0 {
output = bytes.TrimRight(output, "\n")
msg := err.Error() + ": " + string(output)
err = errors.New(msg)
}
return err
}
return nil
}

View File

@ -0,0 +1,17 @@
// +build !linux
package bazilfuse
import (
"os"
"syscall"
)
func unmount(dir string) error {
err := syscall.Unmount(dir, 0)
if err != nil {
err = &os.PathError{Op: "unmount", Path: dir, Err: err}
return err
}
return nil
}