magefile / mage

a Make/rake-like dev tool using Go
https://magefile.org
Apache License 2.0
4.1k stars 251 forks source link

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

Open terev opened 5 years ago

natefinch commented 5 years ago

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, ...)

terev commented 5 years ago

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?