mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-23 19:37:46 +08:00
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>
This commit is contained in:
parent
8405b56df0
commit
2cae0bc616
@ -1,6 +1,7 @@
|
||||
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
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user