Skip to content
Merged
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
10 changes: 7 additions & 3 deletions emsdk
Original file line number Diff line number Diff line change
Expand Up @@ -2531,13 +2531,17 @@ def main():

return 0
elif cmd == 'construct_env':
silentremove(EMSDK_SET_ENV) # Clean up old temp file up front, in case of failure later before we get to write out the new one.
if len(sys.argv) == 2:
outfile = EMSDK_SET_ENV
silentremove(EMSDK_SET_ENV) # Clean up old temp file up front, in case of failure later before we get to write out the new one.
else:
outfile = sys.argv[2]
tools_to_activate = currently_active_tools()
tools_to_activate = process_tool_list(tools_to_activate, log_errors=True)
env_string = construct_env(tools_to_activate, len(sys.argv) >= 3 and 'perm' in sys.argv[2])
open(EMSDK_SET_ENV, 'w').write(env_string)
open(outfile, 'w').write(env_string)
if LINUX or OSX:
os.chmod(EMSDK_SET_ENV, 0o755)
os.chmod(outfile, 0o755)
return 0
elif cmd == 'update':
update_emsdk()
Expand Down
7 changes: 4 additions & 3 deletions emsdk_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# ./emsdk_env.sh
#
# which won't have any effect.

SRC="$BASH_SOURCE"
if [ "$SRC" = "" ]; then
SRC="$0"
Expand All @@ -23,7 +22,9 @@ CURDIR="$(pwd)"
cd "$(dirname "$SRC")"
unset SRC

./emsdk construct_env "$@"
. ./emsdk_set_env.sh
tmpfile=`mktemp` || exit 1
./emsdk construct_env "$@" $tmpfile
. $tmpfile
rm -f $tmpfile

cd "$CURDIR"