goyek / goyek

Task automation Go library

Home Page:https://pkg.go.dev/github.com/goyek/goyek/v2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Passing environment variables to external commands

breml opened this issue · comments

I have an external command, that I would like to call from goyek, where I need to provide some environment variables (there is no way to substitute with e.g. flags for this) and I am wondering about the simplest way of doing this. I know about https://golang.org/pkg/os/exec, but to use this somehow removes the sweetness of short and concise task functions. Unfortunately neither goyek.Exec nor script.Exec (from github.com/bitfield/script) expose the environment variables.

What are your thoughts about this?

OK, found it in your build.go, tf.Cmd does the trick.