Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow precommand hook to export env vars in same shell #162

Merged
merged 1 commit into from
Sep 26, 2024

Conversation

shYkiSto
Copy link
Collaborator

@shYkiSto shYkiSto commented Sep 26, 2024

Allow environment variables exported from the precommand hook to be available for subsequent commands. This is done by executing the precommand in the current shell context rather than a subshell ((eval "$PRECOMMAND")). This enables scenarios where the precommand can be used to prepare the environment for the main command execution.

// manifest.json
{
   "hooks" {
       "precommand": ". tools/jazelle/hooks/prepare_env.sh"
   }
}

// tools/jazelle/hooks/prepare_env.sh
#!/bin/bash
export SOME_CRITICAL_ENV_VAR="test_precommand_env"

% jz yarn node -p "process.env.SOME_CRITICAL_ENV_VAR"
test_precommand_env

@shYkiSto shYkiSto merged commit 22b1244 into uber-web:main Sep 26, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants