(ctx context.Context, cmdChain []*Command)
| 398 | } |
| 399 | |
| 400 | func runBefore(ctx context.Context, cmdChain []*Command) (context.Context, error) { |
| 401 | for _, cmd := range cmdChain { |
| 402 | if cmd.Before == nil { |
| 403 | continue |
| 404 | } |
| 405 | if bctx, err := cmd.Before(ctx, cmd); err != nil { |
| 406 | return ctx, cmd.handleExitCoder(ctx, err) |
| 407 | } else if bctx != nil { |
| 408 | ctx = bctx |
| 409 | } |
| 410 | } |
| 411 | return ctx, nil |
| 412 | } |