1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-09-10 05:52:20 +08:00

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.
This commit is contained in:
Tor Arne Vestbø
2015-04-17 18:46:04 +02:00
committed by Tor Arne Vestbø
parent 00a6e595ba
commit 3d05764262

View File

@ -226,7 +226,6 @@ func (i *cmdInvocation) Parse(ctx context.Context, args []string) error {
if err != nil {
return err
}
i.req.Context().Context = ctx
repoPath, err := getRepoPath(i.req)
if err != nil {
@ -279,6 +278,8 @@ func callCommand(ctx context.Context, req cmds.Request, root *cmds.Command, cmd
log.Info(config.EnvDir, " ", req.Context().ConfigRoot)
var res cmds.Response
req.Context().Context = ctx
details, err := commandDetails(req.Path(), root)
if err != nil {
return nil, err