@cryptotaxi247 / kubo / commits / b6081be32

only construct a node in online mode when running external commands.

This breaks commands like `ipfs update` that expect IPFS to *not* be running. fixes #5191 License: MIT Signed-off-by: Steven Allen <steven@stebalien.com>

Steven Allen committed Jul 5, 2018 at 14:08 UTC b6081be32adc1d3638c546092ee6f6f24e794572
1 file changed +10 -2
core/commands/external.go
+10 -2
@@ -52,8 +52,16 @@ func ExternalBinary() *cmds.Command {
52 // setup env of child program
53 env := os.Environ()
54
55 - nd, err := req.InvocContext().GetNode()
56 - if err == nil {
55 + // Get the node iff already defined.
56 + if req.InvocContext().Online {
57 + nd, err := req.InvocContext().GetNode()
58 + if err != nil {
59 + res.SetError(fmt.Errorf(
60 + "failed to start ipfs node: %s",
61 + err,
62 + ), cmdkit.ErrFatal)
63 + return
64 + }
65 env = append(env, fmt.Sprintf("IPFS_ONLINE=%t", nd.OnlineMode()))
66 }
67