tests: call umount instead of fusermount on OSX

Reported at https://github.com/rfjakob/gocryptfs/issues/15
This commit is contained in:
Jakob Unterwurzacher 2016-07-02 20:06:20 +02:00
parent 54470baa23
commit d5b7eb33da
1 changed files with 10 additions and 4 deletions

View File

@ -8,6 +8,7 @@ import (
"os" "os"
"os/exec" "os/exec"
"path/filepath" "path/filepath"
"runtime"
"syscall" "syscall"
"testing" "testing"
"time" "time"
@ -142,10 +143,15 @@ func MountOrFatal(t *testing.T, c string, p string, extraArgs ...string) {
// Unmount PLAINDIR "p" // Unmount PLAINDIR "p"
func Unmount(p string) error { func Unmount(p string) error {
fu := exec.Command("fusermount", "-u", "-z", p) var cmd *exec.Cmd
fu.Stdout = os.Stdout if runtime.GOOS == "darwin" {
fu.Stderr = os.Stderr cmd = exec.Command("umount", p)
err := fu.Run() } else {
cmd = exec.Command("fusermount", "-u", "-z", p)
}
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err := cmd.Run()
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)
panic(err) panic(err)