mage icon indicating copy to clipboard operation
mage copied to clipboard

Provide a way (in mage.sh) to pass an optional context down to call CommandContext so cancellation signals can propagate

Open terev opened this issue 5 years ago • 2 comments

terev avatar Feb 04 '19 04:02 terev

yup, 100% need to add context versions of all the sh functions (or more likely a separate package for them so they don't need dumb names like sh.RunCtx(ctx, ...)

natefinch avatar Feb 04 '19 04:02 natefinch

Sounds great. There are some utilities that can be shared between the two packages like CmdRan, ExitStatus these are the things I would like to be called behind the scenes in my magefiles.

My current use case for this feature is opening a kubectl port forward to a service pod in a goroutine then opening a cli session to the forwarded port.

I'd be happy to help out with the implementation, it should mostly be copying what is using exec.Command and adding a ctx arg to the signature, no?

terev avatar Feb 04 '19 04:02 terev