package tplCmd import ( `os` `os/exec` ) /* ToCmd returns an (os/)exec.Cmd from a Cmd. err will always be nil for now, but is still returned and should be handled for future-proofing. */ func (c *Cmd) ToCmd() (cmd *exec.Cmd, err error) { var envs []string if c.Args != nil && len(c.Args) > 0 { cmd = exec.Command(c.Program, c.Args...) } else { cmd = exec.Command(c.Program) } if !c.IsolateEnv { envs = os.Environ() } if c.EnvVars != nil && len(c.EnvVars) > 0 { envs = append(envs, c.EnvVars...) } cmd.Env = envs return }