github.com/scaleoutsean/fusego@v0.0.0-20220224074057-4a6429e46bb8/unmount_linux.go (about)

     1  package fuse
     2  
     3  import (
     4  	"bytes"
     5  	"fmt"
     6  	"os/exec"
     7  )
     8  
     9  func unmount(dir string) error {
    10  	// Call fusermount.
    11  	cmd := exec.Command("fusermount", "-u", dir)
    12  	output, err := cmd.CombinedOutput()
    13  	if err != nil {
    14  		if len(output) > 0 {
    15  			output = bytes.TrimRight(output, "\n")
    16  			return fmt.Errorf("%v: %s", err, output)
    17  		}
    18  
    19  		return err
    20  	}
    21  	return nil
    22  }