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

Fix support fish shell in emsdk.py #1239

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions emsdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just # Pick which shell to use?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should add some basic CI testing for other shells?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌 I agree with you.

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
Expand Down Expand Up @@ -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


Expand All @@ -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

Expand Down
2 changes: 2 additions & 0 deletions emsdk_env.fish
Original file line number Diff line number Diff line change
Expand Up @@ -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