From e78d77ca284b3dcb61d6f901e92a46a9836d74d8 Mon Sep 17 00:00:00 2001 From: chase Date: Fri, 23 Jun 2023 19:00:27 +0800 Subject: [PATCH] fix: support fish shell in emsdk.py --- emsdk.py | 9 +++++++-- emsdk_env.fish | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/emsdk.py b/emsdk.py index 17b8506b7e..31f3d29033 100644 --- a/emsdk.py +++ b/emsdk.py @@ -114,15 +114,16 @@ def exit_with_error(msg): UNIX = (MACOS or LINUX) -# Pick which shell of 4 shells to use +# Pick which shell of 5 shells to use POWERSHELL = bool(os.getenv('EMSDK_POWERSHELL')) CSH = bool(os.getenv('EMSDK_CSH')) CMD = bool(os.getenv('EMSDK_CMD')) BASH = bool(os.getenv('EMSDK_BASH')) +FISH = bool(os.getenv('EMSDK_FISH')) if WINDOWS and BASH: MSYS = True -if not CSH and not POWERSHELL and not BASH and not CMD: +if not CSH and not POWERSHELL and not BASH and not CMD and not FISH: # Fall back to default of `cmd` on windows and `bash` otherwise if WINDOWS and not MSYS: CMD = True @@ -2538,6 +2539,8 @@ def unset_env(key): return 'unsetenv %s;\n' % key if BASH: return 'unset %s;\n' % key + if FISH: + return 'set -e %s;\n' % key assert False @@ -2559,6 +2562,8 @@ def construct_env_with_vars(env_vars_to_add): env_string += 'setenv ' + key + ' "' + value + '";\n' elif BASH: env_string += 'export ' + key + '="' + value + '";\n' + elif FISH: + env_string += 'set -x ' + key + ' ' + value + '\n' else: assert False diff --git a/emsdk_env.fish b/emsdk_env.fish index 29f6f4647b..20b507927a 100644 --- a/emsdk_env.fish +++ b/emsdk_env.fish @@ -5,8 +5,10 @@ set -l script (status -f) set -l dir (dirname $script) +set -x -l EMSDK_FISH 1 eval ($dir/emsdk construct_env) set -e -l script set -e -l dir +set -e -l EMSDK_FISH