@cryptotaxi247 / kubo / commits / 2cae0bc61

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: Jakub Sztandera <kubuxu@protonmail.ch>

Jakub Sztandera committed Aug 1, 2016 at 13:02 UTC 2cae0bc616a655ac8f0dc4570da8f0e79b8548df
2 files changed +11
cmd/ipfs/daemon.go
+6
@@ -1,6 +1,7 @@
1 package main
2
3 import (
4 + "errors"
5 _ "expvar"
6 "fmt"
7 "net"
@@ -338,6 +339,11 @@ func daemonFunc(req cmds.Request, res cmds.Response) {
339 res.SetError(err, cmds.ErrNormal)
340 return
341 }
342 + if mount && offline {
343 + res.SetError(errors.New("mount is not supported in offline mode"),
344 + cmds.ErrClient)
345 + return
346 + }
347 if mount {
348 if err := mountFuse(req); err != nil {
349 res.SetError(err, cmds.ErrNormal)
test/sharness/t0600-issues-and-regressions-online.sh
+5
@@ -29,5 +29,10 @@ test_expect_success "no panic traces on daemon" '
29
30 test_kill_ipfs_daemon
31
32 +test_expect_success "ipfs daemon --offline --mount fails - #2995" '
33 + (test_must_fail ipfs daemon --offline --mount 2>daemon_err) &&
34 + grep "mount is not supported in offline mode" daemon_err
35 +'
36 +
37 test_done
38