Exemple #1
0
// Unmount local
func Unmount(mntDir string) error {
	if err := fuse.Unmount(mntDir); err != nil {
		log.WithFields(log.Fields{"Error": err}).
			Error("Revelo: Cannot unmount")
		return err
	}

	return nil
}
Exemple #2
0
// Close unmounts the filesystem and waits for fs.Serve to return. Any
// returned error will be stored in Err. It is safe to call Close
// multiple times.
func (mnt *Mount) Close() {
	if mnt.closed {
		return
	}
	mnt.closed = true
	for tries := 0; tries < 1000; tries++ {
		err := fuse.Unmount(mnt.Dir)
		if err != nil {
			// TODO do more than log?
			log.Printf("unmount error: %v", err)
			time.Sleep(10 * time.Millisecond)
			continue
		}
		break
	}
	<-mnt.done
	mnt.Conn.Close()
	os.Remove(mnt.Dir)
}