-
-
Notifications
You must be signed in to change notification settings - Fork 37
Closed
Labels
Description
Describe the bug
Using ahoy on a command without a .env file allows me to access environment
variables of the parent process. (As expected). However, when including a .env file,
environment variables from the parent process are no longer available.
This makes ahoy basically unusable as the PATH variable is clobbered.
> ahoy terraform-plan
terraform-plan: terraform: command not found
To reproduce
Setup
Given the following .ahoy.yml
file:
ahoyapi: v2
commands:
test:
usage: Test what happens naturally
cmd: |
echo TEST=$TEST
echo PATH=$PATH
test-with-env:
env: .env
usage: Test what happens when we have a .env file
cmd: |
echo TEST=$TEST
echo PATH=$PATH
and the following .env file:
TEST="Hello, World!"
Reproducing
export TEST=1234
> ahoy test
TEST=1234
PATH=/Users/[redacted]/.venv/[redacted]/bin:/opt/homebrew/bin:...
> ahoy test-with-env
TEST=Hello, World!
PATH=/usr/gnu/bin:/usr/local/bin:/bin:/usr/bin:.
test
works as expected, however test-with-env
clobbers my PATH.
Expected behaviour
I would expect my host variables to be retained so I don't have to re-add every environment variable to my .env files.
System details (please complete the following information):
- OS: macOS
- Ahoy version: 2.3.0-homebrew (also built from main branch, same result)
Additional context
ocean