Skip to content

Commit

Permalink
Use execvp rather then execv in exec_process (#22737)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
sbc100 authored Oct 15, 2024
1 parent a14648c commit 9c9b764
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,7 @@ jobs:
EMTEST_SKIP_NODE_CANARY: "1"
EMTEST_SKIP_WASM64: "1"
steps:
- run: apt-get install -q -y ninja-build scons
- run: apt-get install -q -y ninja-build scons ccache
- run-tests-linux:
# some native-dependent tests fail because of the lack of native
# headers on emsdk-bundled clang
Expand Down
17 changes: 17 additions & 0 deletions test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,18 @@ def decorated(self, *args, **kwargs):
return decorated


def requires_ccache(func):
assert callable(func)

@wraps(func)
def decorated(self, *args, **kwargs):
if not shutil.which('ccache'):
self.fail('test requires ccache to be installed (available in PATH)')
return func(self, *args, **kwargs)

return decorated


def requires_scons(func):
assert callable(func)

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

@requires_ccache
@with_env_modify({'EM_COMPILER_WRAPPER': 'ccache'})
def test_compiler_wrapper_ccache(self):
self.do_runf('hello_world.c', 'hello, world!')

def test_llvm_option_dash_o(self):
# emcc used to interpret -mllvm's option value as the output file if it
# began with -o
Expand Down
2 changes: 1 addition & 1 deletion tools/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ def exec_process(cmd):
else:
sys.stdout.flush()
sys.stderr.flush()
os.execv(cmd[0], cmd)
os.execvp(cmd[0], cmd)


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

0 comments on commit 9c9b764

Please sign in to comment.