Sync up request context with root context just before calling command
The context passed on from main() may change before we hit callCommand, so setting it in Parse is a bit optimistic.
Tor Arne Vestbø committed
Apr 17, 2015 at 18:46 UTC
3d05764262b00f755145317b5c3bb7efb2fae7f7
1 file changed
+2
-1
cmd/ipfs/main.go
+2
-1
@@ -226,7 +226,6 @@ func (i *cmdInvocation) Parse(ctx context.Context, args []string) error {
226
if err != nil {
227
return err
228
}
229
- i.req.Context().Context = ctx
229
230
repoPath, err := getRepoPath(i.req)
231
if err != nil {
@@ -279,6 +278,8 @@ func callCommand(ctx context.Context, req cmds.Request, root *cmds.Command, cmd
278
log.Info(config.EnvDir, " ", req.Context().ConfigRoot)
279
var res cmds.Response
280
281
+ req.Context().Context = ctx
282
+
283
details, err := commandDetails(req.Path(), root)
284
if err != nil {
285
return nil, err