wait for daemon to completely stop, even on error
License: MIT Signed-off-by: Steven Allen <steven@stebalien.com>
Steven Allen committed
Apr 3, 2019 at 15:59 UTC
285a2764180524906d535e24d5005222c7076906
2 files changed
+5
-2
cmd/ipfs/daemon.go
+4
-2
@@ -24,6 +24,7 @@ import (
24
fsrepo "github.com/ipfs/go-ipfs/repo/fsrepo"
25
migrate "github.com/ipfs/go-ipfs/repo/fsrepo/migrations"
26
27
+ "github.com/hashicorp/go-multierror"
28
"github.com/ipfs/go-ipfs-cmdkit"
29
cmds "github.com/ipfs/go-ipfs-cmds"
30
mprome "github.com/ipfs/go-metrics-prometheus"
@@ -421,13 +422,14 @@ func daemonFunc(req *cmds.Request, re cmds.ResponseEmitter, env cmds.Environment
422
423
// collect long-running errors and block for shutdown
424
// TODO(cryptix): our fuse currently doesnt follow this pattern for graceful shutdown
425
+ var errs error
426
for err := range merge(apiErrc, gwErrc, gcErrc) {
427
if err != nil {
426
- return err
428
+ errs = multierror.Append(errs, err)
429
}
430
}
431
430
- return nil
432
+ return errs
433
}
434
435
// serveHTTPApi collects options, creates listener, prints status message and starts serving requests
go.mod
+1
@@ -12,6 +12,7 @@ require (
12
github.com/fatih/color v1.7.0 // indirect
13
github.com/fsnotify/fsnotify v1.4.7
14
github.com/gogo/protobuf v1.2.1
15
+ github.com/hashicorp/go-multierror v1.0.0
16
github.com/hashicorp/golang-lru v0.5.1
17
github.com/hsanjuan/go-libp2p-http v0.0.2
18
github.com/ipfs/dir-index-html v1.0.3