// setDir sets cmd.Dir to dir, and also adds PWD=dir to cmd's environment. func setDir(cmd *exec.Cmd, dir string) { … } // setEnv sets cmd.Env so that key = value. func setEnv(cmd *exec.Cmd, key, value string) { … } // unsetEnv sets cmd.Env so that key is not present in the environment. func unsetEnv(cmd *exec.Cmd, key string) { … }