fix: emsdk swallows/overwrites parts of PATH (#642)

This PR has three changes: 

1) Fixing --permanent flag:
The previous algorithm looped over the values of PATH 4 times to check conditions while these conditions are the opposite of each other. Also, the result did not include all the parts in the whole_path. 

	I have combined these loops and fixed the algorithm, so no path is lost. Now using --permanent the PATH and Env variables are correctly updated.

2) Fixing --system flag:
Now, the system flag does not cause the PATH values to be overwritten/clobbered. The PATH/Env variables are correctly updated.

3) Fixing flagless flag:
When no flag is provided the value of process/shell is correctly updated and preserved.

This adds the tests for all the situations.

Fixes #634
Fixes #645
This commit is contained in:
Amin Yahyaabadi
2020-10-30 22:57:15 -05:00
committed by GitHub
parent 4a695be348
commit 40780130aa
5 changed files with 345 additions and 91 deletions

View File

@@ -87,11 +87,46 @@ jobs:
command: |
source emsdk_env.sh
python scripts/test.py
- run:
name: flagless (process/shell) test
shell: powershell.exe
command: |
scripts/test_activation.ps1
- run:
name: --permanent test
shell: powershell.exe
command: |
scripts/test_permanent.ps1
$env:PERMANENT_FLAG="--permanent"
scripts/test_activation.ps1
- run:
name: --system test
shell: powershell.exe
command: |
$env:SYSTEM_FLAG="--system"
scripts/test_activation.ps1
- run:
name: Process/Shell PATH preservation test
shell: powershell.exe
command: |
scripts/test_path_preservation.ps1
- run:
name: User PATH preservation test
shell: powershell.exe
command: |
$env:PERMANENT_FLAG="--permanent"
scripts/test_path_preservation.ps1
- run:
name: System PATH preservation test
shell: powershell.exe
command: |
$env:SYSTEM_FLAG="--system"
scripts/test_path_preservation.ps1
build-docker-image:
executor: bionic