Commit 41b7f6d3 authored by Juan Batiz-Benet's avatar Juan Batiz-Benet

Merge pull request #1391 from ipfs/fix-fuse-err

fix fuse mount error in linux
parents b46712bd bc85a638
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment