google / starlark-go

Starlark in Go: the Starlark configuration language, implemented in Go
BSD 3-Clause "New" or "Revised" License
2.26k stars 204 forks source link

Add a OnMaxSteps optional handler to Thread (#410) #411

Closed cheezypoofs closed 1 year ago

cheezypoofs commented 1 year ago

This hook gives someone the ability to intercept and potentially change the behavior when maxSteps is reached. The default behavior of canceling is preserved.

cheezypoofs commented 1 year ago

Thanks, this looks good. Once you've signed the CLA we can get this merged.

github is showing that I signed it I think? image

adonovan commented 1 year ago

Thanks again. I can imagine a number of uses for this, like imposing a soft limit that prints "execution of foo.star is taking a long time..." before reaching the hard limit that terminates execution.