diff --git a/core/commands/mount_unix.go b/core/commands/mount_unix.go index 7378d437bc146edb0a7ccaa440f74bd27e15ad14..5999ba6a8ae6de639c9bd69abdde34a234297b13 100644 --- a/core/commands/mount_unix.go +++ b/core/commands/mount_unix.go @@ -24,6 +24,9 @@ const mountTimeout = time.Second // fuseNoDirectory used to check the returning fuse error const fuseNoDirectory = "fusermount: failed to access mountpoint" +// fuseExitStatus1 used to check the returning fuse error +const fuseExitStatus1 = "fusermount: exit status 1" + // platformFuseChecks can get overridden by arch-specific files // to run fuse checks (like checking the OSXFUSE version) var platformFuseChecks = func(*core.IpfsNode) error { @@ -181,13 +184,17 @@ func Mount(node *core.IpfsNode, fsdir, nsdir string) error { } func doMount(node *core.IpfsNode, fsdir, nsdir string) error { - fmtFuseErr := func(err error) error { + fmtFuseErr := func(err error, mountpoint string) error { s := err.Error() if strings.Contains(s, fuseNoDirectory) { s = strings.Replace(s, `fusermount: "fusermount:`, "", -1) s = strings.Replace(s, `\n", exit status 1`, "", -1) return cmds.ClientError(s) } + if s == fuseExitStatus1 { + s = fmt.Sprintf("fuse failed to access mountpoint %s", mountpoint) + return cmds.ClientError(s) + } return err } @@ -222,9 +229,9 @@ func doMount(node *core.IpfsNode, fsdir, nsdir string) error { } if err1 != nil { - return fmtFuseErr(err1) + return fmtFuseErr(err1, fsdir) } - return fmtFuseErr(err2) + return fmtFuseErr(err2, nsdir) } // setup node state, so that it can be cancelled