Skip to content

Commit

Permalink
Merge pull request #826 from newrelic/chore/cancel-recipe-130
Browse files Browse the repository at this point in the history
fix(chore): detect error code 130 and set outcome as canceled
  • Loading branch information
Julien4218 authored Apr 29, 2021
2 parents cc296ce + 29244e1 commit ee81b4c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions internal/install/execution/go_task_recipe_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,21 @@ func (re *GoTaskRecipeExecutor) Execute(ctx context.Context, m types.DiscoveryMa
}

if err := e.Run(ctx, calls...); err != nil {
log.WithFields(log.Fields{
"err": err,
}).Debug("Task execution returned error")

// go-task does not provide an error type to denote context cancelation
// Therefore we need to match inside the error message
if strings.Contains(err.Error(), "context canceled") {
return types.ErrInterrupt
}

// Recipe trigger a canceled event with specific exit code 130 used
if strings.Contains(err.Error(), "exit status 130") {
return types.ErrInterrupt
}

return err
}

Expand Down

0 comments on commit ee81b4c

Please sign in to comment.