From 93ad2bd057baa3ac4b237a9ecc4e18ac886b3ead Mon Sep 17 00:00:00 2001 From: Juan Batiz-Benet Date: Sun, 16 Nov 2014 02:22:53 -0800 Subject: [PATCH] mount: if already mounted, unmount before new attempt This is because if the user specifies that they want to mount multiple times, something must be wrong. try unmounting to reset things and then proceed. --- core/commands2/mount_unix.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/commands2/mount_unix.go b/core/commands2/mount_unix.go index 2c9a8fc97..51a957ad9 100644 --- a/core/commands2/mount_unix.go +++ b/core/commands2/mount_unix.go @@ -98,6 +98,16 @@ baz return nil, err } + // check if we already have live mounts. + // if the user said "Mount", then there must be something wrong. + // so, close them and try again. + if node.Mounts.Ipfs != nil { + node.Mounts.Ipfs.Unmount() + } + if node.Mounts.Ipns != nil { + node.Mounts.Ipns.Unmount() + } + // error if we aren't running node in online mode if node.Network == nil { return nil, errNotOnline