File: unmount_linux.go

package info (click to toggle)
golang-github-jacobsa-bazilfuse 0.0~git20150622-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 736 kB
  • ctags: 1,364
  • sloc: sh: 26; makefile: 5
file content (21 lines) | stat: -rw-r--r-- 364 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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
}