macOS: use string array to be compatible with both bash and zsh

By default, zsh does not split words in string by spaces.
See https://zsh.sourceforge.io/FAQ/zshfaq03.html

Change-Id: I167bae2af628be5b2fc9429a090628b6049f7ce4
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Xiaofeng Wang
2022-02-07 13:45:11 +08:00
parent b8b5687f21
commit 0d17063e82

View File

@@ -42,9 +42,9 @@ def clean_environment_script():
'TERM_SESSION_ID'])
return r'''
function ignore() {
local keys="''' + env_to_keep + '''"
local keys=(''' + env_to_keep + ''')
local v=$1
for e in $keys; do [[ "$e" == "$v" ]] && return 0; done
for e in "${keys[@]}"; do [[ "$e" == "$v" ]] && return 0; done
}
while read -r line; do
key=$(echo $line | /usr/bin/cut -d '=' -f 1)