Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sanitize python env and subprocess i/o #16736

Merged
merged 12 commits into from
Jun 13, 2022
4 changes: 3 additions & 1 deletion emcc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
# To make modifications to this file, edit `tools/run_python_compiler.sh` and
# then run `tools/create_entry_points.py`

unset _PYTHON_SYSCONFIGDATA_NAME

if [ -z "$PYTHON" ]; then
PYTHON=$EMSDK_PYTHON
fi
Expand All @@ -29,7 +31,7 @@ if [ -z "$PYTHON" ]; then
fi

if [ -z "$_EMCC_CCACHE" ]; then
exec "$PYTHON" "$0.py" "$@"
exec "$PYTHON" -E "$0.py" "$@"
else
unset _EMCC_CCACHE
exec ccache "$0" "$@"
Expand Down
2 changes: 1 addition & 1 deletion emconfigure
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ if [ -z "$PYTHON" ]; then
exit 1
fi

exec "$PYTHON" "$0.py" "$@"
exec "$PYTHON" -E "$0.py" "$@"
pmp-p marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion emmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ if [ -z "$PYTHON" ]; then
exit 1
fi

exec "$PYTHON" "$0.py" "$@"
exec "$PYTHON" -E "$0.py" "$@"
1 change: 1 addition & 0 deletions tools/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ def run_process(cmd, check=True, input=None, *args, **kw):
sys.stdout.flush()
sys.stderr.flush()
kw.setdefault('universal_newlines', True)
kw.setdefault('encoding', 'utf-8')
pmp-p marked this conversation as resolved.
Show resolved Hide resolved
ret = subprocess.run(cmd, check=check, input=input, *args, **kw)
debug_text = '%sexecuted %s' % ('successfully ' if check else '', shlex_join(cmd))
logger.debug(debug_text)
Expand Down