Commit 2cae0bc6 authored by Jakub Sztandera's avatar Jakub Sztandera Committed by Jeromy

daemon: ipfs daemon --offline --mount should fail with nice message

ipfs daemon --offline;
ipfs mount;
fails. This uniforms this behaviour.

License: MIT
Signed-off-by: default avatarJakub Sztandera <kubuxu@protonmail.ch>
parent 8405b56d
package main
import (
"errors"
_ "expvar"
"fmt"
"net"
......@@ -338,6 +339,11 @@ func daemonFunc(req cmds.Request, res cmds.Response) {
res.SetError(err, cmds.ErrNormal)
return
}
if mount && offline {
res.SetError(errors.New("mount is not supported in offline mode"),
cmds.ErrClient)
return
}
if mount {
if err := mountFuse(req); err != nil {
res.SetError(err, cmds.ErrNormal)
......
......@@ -29,5 +29,10 @@ test_expect_success "no panic traces on daemon" '
test_kill_ipfs_daemon
test_expect_success "ipfs daemon --offline --mount fails - #2995" '
(test_must_fail ipfs daemon --offline --mount 2>daemon_err) &&
grep "mount is not supported in offline mode" daemon_err
'
test_done
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