Skip to content

Commit 9c9b764

Browse files
authored
Use execvp rather then execv in exec_process (#22737)
When this code was added in #20909 it broke users who were doing `EM_COMPILER_WRAPPER=cache` since it was not using PATH to find the executable (unlike the subprocess module). Fixes: #22736
1 parent a14648c commit 9c9b764

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,7 @@ jobs:
787787
EMTEST_SKIP_NODE_CANARY: "1"
788788
EMTEST_SKIP_WASM64: "1"
789789
steps:
790-
- run: apt-get install -q -y ninja-build scons
790+
- run: apt-get install -q -y ninja-build scons ccache
791791
- run-tests-linux:
792792
# some native-dependent tests fail because of the lack of native
793793
# headers on emsdk-bundled clang

test/test_other.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,18 @@ def decorated(self, *args, **kwargs):
154154
return decorated
155155

156156

157+
def requires_ccache(func):
158+
assert callable(func)
159+
160+
@wraps(func)
161+
def decorated(self, *args, **kwargs):
162+
if not shutil.which('ccache'):
163+
self.fail('test requires ccache to be installed (available in PATH)')
164+
return func(self, *args, **kwargs)
165+
166+
return decorated
167+
168+
157169
def requires_scons(func):
158170
assert callable(func)
159171

@@ -12554,6 +12566,11 @@ def test_compiler_wrapper(self):
1255412566
self.assertContained('wrapping compiler call: ', stdout)
1255512567
self.assertExists('test_hello_world.o')
1255612568

12569+
@requires_ccache
12570+
@with_env_modify({'EM_COMPILER_WRAPPER': 'ccache'})
12571+
def test_compiler_wrapper_ccache(self):
12572+
self.do_runf('hello_world.c', 'hello, world!')
12573+
1255712574
def test_llvm_option_dash_o(self):
1255812575
# emcc used to interpret -mllvm's option value as the output file if it
1255912576
# began with -o

tools/shared.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ def exec_process(cmd):
249249
else:
250250
sys.stdout.flush()
251251
sys.stderr.flush()
252-
os.execv(cmd[0], cmd)
252+
os.execvp(cmd[0], cmd)
253253

254254

255255
def run_js_tool(filename, jsargs=[], node_args=[], **kw): # noqa: mutable default args

0 commit comments

Comments
 (0)