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
21 lines
362 B
package unmount
|
|
|
|
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
|
|
}
|