risor-io / risor

Fast and flexible scripting for Go developers and DevOps.
https://risor.io
Apache License 2.0
576 stars 24 forks source link

Stop execution of `VirtualMachine.Call` when context cancelled. #242

Open gurleensethi opened 1 month ago

gurleensethi commented 1 month ago

Add the ability to stop execution of VirtualMachine.Call when context is cancelled. Currently cancelling the context does nothing.

// This context comes from a different place where it gets cancelled after X seconds
_, err = virtualMachine.Call(ctx, o.runFn, []object.Object{})
if err != nil {
    // Can figure out here if execution was stopped due to cancelled context
}