Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions Doc/using/windows.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Comment on lines +878 to +879

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I worry that this makes it sound like an appealing feature, not an unintentional side-effect.

Can we warn instead about the command line having to accept the same options as the Python command line? That's the more useful information for someone who's trying to do this on purpose.

(There are also non-WSL "bash.exe"s out there, so I really don't want to start people thinking they can make Windows users run on Linux by putting bash in the shebang...)



Arguments in shebang lines
--------------------------
Expand Down