From b965a30a1c5e8407f9ab1ed5de48e4d98bb118ff Mon Sep 17 00:00:00 2001 From: Christopher Durham Date: Fri, 12 Aug 2022 23:34:37 -0500 Subject: [PATCH 1/2] Note launcher's env ability to launch non-python --- Doc/using/windows.rst | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Doc/using/windows.rst b/Doc/using/windows.rst index a289435a2f51db..7606c0a10b8fdd 100644 --- a/Doc/using/windows.rst +++ b/Doc/using/windows.rst @@ -866,13 +866,18 @@ minor version. I.e. ``/usr/bin/python3.7-32`` will request usage of the The ``/usr/bin/env`` form of shebang line has one further special property. Before looking for installed Python interpreters, this form will search the -executable :envvar:`PATH` for a Python executable. This corresponds to the -behaviour of the Unix ``env`` program, which performs a :envvar:`PATH` search. +executable :envvar:`PATH` for an executable. This corresponds to the behaviour +of the Unix ``env`` program, which performs a :envvar:`PATH` search. Note that +this can find and run non-Python executables if specified in the shebang line[#]_. If an executable matching the first argument after the ``env`` command cannot be found, it will be handled as described below. Additionally, the environment variable :envvar:`PYLAUNCHER_NO_SEARCH_PATH` may be set (to any value) to skip this additional search. +.. [#] This can cause surprising effects with `#!/usr/bin/env bash` or other + non-Python interpreters meant to trampoline into Python, as this could select + a WSL `bash`, causing the script to run under WSL instead of running natively. + Arguments in shebang lines -------------------------- From fa21ab60abf73a0c1dc596803eb9e0904030ce6e Mon Sep 17 00:00:00 2001 From: Christopher Durham Date: Fri, 12 Aug 2022 23:44:24 -0500 Subject: [PATCH 2/2] Fix footnote syntax --- Doc/using/windows.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/using/windows.rst b/Doc/using/windows.rst index 7606c0a10b8fdd..c97c261c0064c6 100644 --- a/Doc/using/windows.rst +++ b/Doc/using/windows.rst @@ -868,7 +868,7 @@ The ``/usr/bin/env`` form of shebang line has one further special property. Before looking for installed Python interpreters, this form will search the executable :envvar:`PATH` for an executable. This corresponds to the behaviour of the Unix ``env`` program, which performs a :envvar:`PATH` search. Note that -this can find and run non-Python executables if specified in the shebang line[#]_. +this can find and run non-Python executables if specified in the shebang line [#]_. If an executable matching the first argument after the ``env`` command cannot be found, it will be handled as described below. Additionally, the environment variable :envvar:`PYLAUNCHER_NO_SEARCH_PATH` may be set (to any value) to skip