mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-08-16 17:00:35 +03:00
Ports: Don't set previously unset environment variables
Co-authored-by: Tim Schumacher <timschumi@gmx.de> Co-authored-by: Jelle Raaijmakers <jelle@gmta.nl>
This commit is contained in:
parent
bdd3a16b16
commit
a6dd0e6339
Notes:
sideshowbarker
2024-07-17 18:49:10 +09:00
Author: https://github.com/fdellwing Commit: https://github.com/SerenityOS/serenity/commit/a6dd0e6339 Pull-request: https://github.com/SerenityOS/serenity/pull/20636 Reviewed-by: https://github.com/timschumi ✅
@ -1,13 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
exec env -i SERENITY_STRIPPED_ENV=1 \
|
||||
HOME="${HOME}" \
|
||||
USER="${USER}" \
|
||||
TERM="${TERM}" \
|
||||
PATH="${PATH}" \
|
||||
EDITOR="${EDITOR:-}" \
|
||||
MAKEJOBS="${MAKEJOBS:-}" \
|
||||
IN_SERENITY_PORT_DEV="${IN_SERENITY_PORT_DEV:-}" \
|
||||
SERENITY_ARCH="${SERENITY_ARCH:-}" \
|
||||
SERENITY_TOOLCHAIN="${SERENITY_TOOLCHAIN:-}" \
|
||||
"${@}"
|
||||
environment_variables=(
|
||||
"HOME=${HOME}"
|
||||
"PATH=${PATH}"
|
||||
"SERENITY_STRIPPED_ENV=1"
|
||||
"TERM=${TERM}"
|
||||
"USER=${USER}"
|
||||
)
|
||||
|
||||
# If any of the following optional variables are set, keep them.
|
||||
keep_environment_variables=(
|
||||
'EDITOR'
|
||||
'IN_SERENITY_PORT_DEV'
|
||||
'MAKEJOBS'
|
||||
'SERENITY_ARCH'
|
||||
'SERENITY_TOOLCHAIN'
|
||||
'VISUAL'
|
||||
)
|
||||
|
||||
for environment_variable_name in "${keep_environment_variables[@]}"; do
|
||||
if [ -v "${environment_variable_name}" ]; then
|
||||
environment_variables+=("${environment_variable_name}=${!environment_variable_name}")
|
||||
fi
|
||||
done
|
||||
|
||||
exec env -i "${environment_variables[@]}" "${@}"
|
||||
|
Loading…
Reference in New Issue
Block a user