Skip to content

Commit

Permalink
daemon: ipfs daemon --offline --mount should fail with nice message
Browse files Browse the repository at this point in the history
ipfs daemon --offline;
ipfs mount;
fails. This uniforms this behaviour.

License: MIT
Signed-off-by: Jakub Sztandera <[email protected]>
  • Loading branch information
Kubuxu authored and whyrusleeping committed Aug 3, 2016
1 parent 8405b56 commit 2cae0bc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cmd/ipfs/daemon.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"errors"
_ "expvar"
"fmt"
"net"
Expand Down Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions test/sharness/t0600-issues-and-regressions-online.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 2cae0bc

Please sign in to comment.