File tree Expand file tree Collapse file tree 3 files changed +47
-2
lines changed Expand file tree Collapse file tree 3 files changed +47
-2
lines changed Original file line number Diff line number Diff line change 80
80
- run :
81
81
name : Install debian packages
82
82
command : apt-get update -q && apt-get install -q -y cmake build-essential openjdk-8-jre-headless ksh zsh
83
+ - run : test/test_node_path.sh
83
84
- run : test/test.sh
84
85
- run : test/test_source_env.sh
85
86
- run :
Original file line number Diff line number Diff line change @@ -1438,9 +1438,18 @@ def get_required_path(active_tools):
1438
1438
path_add = [to_native_path (EMSDK_PATH )]
1439
1439
for tool in active_tools :
1440
1440
if hasattr (tool , 'activated_path' ):
1441
- if hasattr (tool , 'activated_path_skip' ) and which (tool .activated_path_skip ):
1442
- continue
1443
1441
path = to_native_path (tool .expand_vars (tool .activated_path ))
1442
+ # If the tool has an activated_path_skip attribute then we don't add
1443
+ # the tools path to the users path if a program by that name is found
1444
+ # in the existing PATH. This allows us to, for example, add our version
1445
+ # node to the users PATH if, and only if, they don't already have a
1446
+ # another version of node in thier PATH.
1447
+ if hasattr (tool , 'activated_path_skip' ):
1448
+ current_path = which (tool .activated_path_skip )
1449
+ # We found an executable by this name in the current PATH, but we
1450
+ # ignore our own version for this purpose.
1451
+ if current_path and os .path .dirname (current_path ) != path :
1452
+ continue
1444
1453
path_add .append (path )
1445
1454
return path_add
1446
1455
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ echo " Test that node is added to that PATH if, and only if, it is not one already present" .
4
+
5
+ if [ -n " $EMSDK " ]; then
6
+ echo " EMSDK is already defined in this shell. Run tests in a shell without sourcing emsdk_env.sh first"
7
+ exit 1
8
+ fi
9
+
10
+ DIR=$( dirname " $BASH_SOURCE " )
11
+ cd $DIR /..
12
+
13
+ ./emsdk install latest
14
+ ./emsdk activate latest
15
+
16
+ if which node; then
17
+ echo " Test should be run without node in the path"
18
+ exit 1
19
+ fi
20
+
21
+ # Run emsdk_env.sh and confirm that node was added to the PATH
22
+ . emsdk_env.sh
23
+
24
+ if ! which node; then
25
+ echo " node not found in path after emsdk_env.sh"
26
+ exit 1
27
+ fi
28
+
29
+ # Run emsdk_env.sh again and confirm that node is still in the PATH
30
+ . emsdk_env.sh
31
+
32
+ if ! which node; then
33
+ echo " node not found in path after emsdk_env.sh"
34
+ exit 1
35
+ fi
You can’t perform that action at this time.
0 commit comments