Skip to content

Commit 96b0961

Browse files
committed
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 <[email protected]>
1 parent 0bd8ced commit 96b0961

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

cmd/ipfs/daemon.go

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package main
22

33
import (
4+
"errors"
45
_ "expvar"
56
"fmt"
67
"net"
@@ -338,6 +339,11 @@ func daemonFunc(req cmds.Request, res cmds.Response) {
338339
res.SetError(err, cmds.ErrNormal)
339340
return
340341
}
342+
if mount && offline {
343+
res.SetError(errors.New("mount is not supported in offline mode"),
344+
cmds.ErrClient)
345+
return
346+
}
341347
if mount {
342348
if err := mountFuse(req); err != nil {
343349
res.SetError(err, cmds.ErrNormal)

test/sharness/t0600-issues-and-regressions-online.sh

+5
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,10 @@ test_expect_success "no panic traces on daemon" '
2929

3030
test_kill_ipfs_daemon
3131

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+
3237
test_done
3338

0 commit comments

Comments
 (0)