Draft JEP: Launch Single-File Source-Code Programs
john.r.rose at oracle.com
Tue Feb 13 22:37:23 UTC 2018
On Feb 13, 2018, at 10:42 AM, Andrew Haley <aph at redhat.com> wrote:
> OK, I see what you mean. I had thought that Python did this properly,
> but I just tried it and it doesn't work. Well, it works kinda-sorta
> but exactly one argument can be passed on the command line. Eww. :-)
It's not Python's fault! The OS gets in there and launches
python with the required arguments. The rules are very narrow.
The OS doesn't do command line parsing at that level.
See http://man7.org/linux/man-pages/man2/execve.2.html <http://man7.org/linux/man-pages/man2/execve.2.html>
Here's what it says about parsing the shebang line:
> A maximum line length of 127 characters is allowed for the first line
> in an interpreter script.
> The semantics of the optional-arg argument of an interpreter script
> vary across implementations. On Linux, the entire string following
> the interpreter name is passed as a single argument to the
> interpreter, and this string can include white space. However,
> behavior differs on some other systems. Some systems use the first
> white space to terminate optional-arg. On some systems, an
> interpreter script can have multiple arguments, and white spaces in
> optional-arg are used to delimit the arguments.
More information about the jdk-dev