Skip to content

Commit

Permalink
Fix activated_path_skip on repeated running of emsdk_env.sh
Browse files Browse the repository at this point in the history
The first time around `node` was being correctly added to the PATH, but
the second time around this code was observing the emsdk copy of node
in the PATH and assuming it could be skipped.

Fixes: #1240
  • Loading branch information
sbc100 committed Jun 27, 2023
1 parent c883b2a commit caa521f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions emsdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -1438,9 +1438,18 @@ def get_required_path(active_tools):
path_add = [to_native_path(EMSDK_PATH)]
for tool in active_tools:
if hasattr(tool, 'activated_path'):
if hasattr(tool, 'activated_path_skip') and which(tool.activated_path_skip):
continue
path = to_native_path(tool.expand_vars(tool.activated_path))
# If the tool has an activated_path_skip attribute then we don't add
# the tools path to the users path if a program by that name is found
# in the existing PATH. This allows us to, for example, add our version
# node to the users PATH if, and only if, they don't already have a
# another version of node in thier PATH.
if hasattr(tool, 'activated_path_skip'):
current_path = which(tool.activated_path_skip)
# We found an executable by this name in the current PATH, but we
# ignore our own version for this purpose.
if current_path and os.path.dirname(current_path) != path:
continue
path_add.append(path)
return path_add

Expand Down

0 comments on commit caa521f

Please sign in to comment.