diff --git a/cmd/mountlib/mount.go b/cmd/mountlib/mount.go index 1c99d44ac..072b3afff 100644 --- a/cmd/mountlib/mount.go +++ b/cmd/mountlib/mount.go @@ -145,8 +145,8 @@ func NewMountCommand(commandName string, hidden bool, mount MountFn) *cobra.Comm VFSOpt: vfsflags.Opt, } - err := mnt.Mount() - if err == nil { + daemonized, err := mnt.Mount() + if !daemonized && err == nil { err = mnt.Wait() } if err != nil { @@ -167,21 +167,21 @@ func NewMountCommand(commandName string, hidden bool, mount MountFn) *cobra.Comm } // Mount the remote at mountpoint -func (m *MountPoint) Mount() (err error) { +func (m *MountPoint) Mount() (daemonized bool, err error) { if err = m.CheckOverlap(); err != nil { - return err + return false, err } if err = m.CheckAllowings(); err != nil { - return err + return false, err } m.SetVolumeName(m.MountOpt.VolumeName) - // Start background task if --background is specified + // Start background task if --daemon is specified if m.MountOpt.Daemon { - daemonized := startBackgroundMode() + daemonized = startBackgroundMode() if daemonized { - return nil + return true, nil } } @@ -189,9 +189,9 @@ func (m *MountPoint) Mount() (err error) { m.ErrChan, m.UnmountFn, err = m.MountFn(m.VFS, m.MountPoint, &m.MountOpt) if err != nil { - return errors.Wrap(err, "failed to mount FUSE fs") + return false, errors.Wrap(err, "failed to mount FUSE fs") } - return nil + return false, nil } // CheckOverlap checks that root doesn't overlap with mountpoint diff --git a/cmd/serve/docker/volume.go b/cmd/serve/docker/volume.go index 98f577f3d..fd37d5211 100644 --- a/cmd/serve/docker/volume.go +++ b/cmd/serve/docker/volume.go @@ -270,7 +270,7 @@ func (vol *Volume) mount(id string) error { return errors.New("volume filesystem is not ready") } - if err := vol.mnt.Mount(); err != nil { + if _, err := vol.mnt.Mount(); err != nil { return err } vol.mnt.MountedOn = time.Now()