@core/exec: when you pass the `env` parameter to `exec.exec` it creates an empty env
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 5.9k
- Forks
- 1.8k
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
When passing the env parameter to exec.exec or exec.getExecOutput the spawned process will have exactly only the env variables that are in the parameter and nothing else.
This is often not what a user wants. Many other env vars that are included by default (in case the env parameter isn't present) are needed for some commands to run.
To Reproduce
Steps to reproduce the behavior:
- Create a Javacript action with the following code:
const installResult = await exec.getExecOutput(
'brew',
['install', 'docker'],
{
env: { HOMEBREW_NO_AUTO_UPDATE: '1' },
},
)
- Try to run it on a macOS runner.
- You will see broken terminal output and it won't work.
Removing that env parameter makes it all work, because all the other env vars that come by default are needed.
Expected behavior
I want to be able to add env vars to exec calls.
I believe the ability to specify a clean env (like it works now) is still valuable for some use cases, so these two should exist independently.
Additional context
Temporary workaround is to use something like:
{ env: { HOMEBREW_NO_AUTO_UPDATE: '1', ...process.env } }
I am not sure though whether it would work for everyone.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by inspecting the exec.exec and exec.getExecOutput entry points named in the report, focusing on how their env parameter is passed to the spawned process. Confirm the current behavior with the macOS brew example or an equivalent environment-sensitive command. Done means callers can add variables while preserving the existing environment, while a separate clean-environment behavior remains available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100