Skip to content

Commit

Permalink
fix (argo wait): use functions to constrain ctx instead of blocks (#1…
Browse files Browse the repository at this point in the history
…0140)

Signed-off-by: scott <scottwangsxll@gmail.com>
  • Loading branch information
sxllwx committed Dec 1, 2022
1 parent d915442 commit a6aca18
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cmd/argoexec/commands/wait.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ func waitContainer(ctx context.Context) error {
defer stats.LogStats()
stats.StartStatsTicker(5 * time.Minute)

// use a block to constrain the scope of ctx
{
// use a function to constrain the scope of ctx
func() {
// this allows us to gracefully shutdown, capturing artifacts
ctx, cancel := signal.NotifyContext(ctx, syscall.SIGTERM)
defer cancel()
Expand All @@ -43,7 +43,7 @@ func waitContainer(ctx context.Context) error {
if err != nil {
wfExecutor.AddError(err)
}
}
}()
// Capture output script result
err := wfExecutor.CaptureScriptResult(ctx)
if err != nil {
Expand Down

0 comments on commit a6aca18

Please sign in to comment.