Charles-François Natali <neolo...@free.fr> added the comment:

> I think it should at least include "bad interpreter", otherwise it is a tad 
> misleading.

It just forwards the error raised by the exec system call:

$ cat foo.sh 
#! /bin/foo
$ strace ./foo.sh 
execve("./foo.sh", ["./foo.sh"], [/* 38 vars */]) = -1 ENOENT (No such file or 
directory)

> Subprocess is throwing the correct exception, what it isn't doing is 
> preserving stderr.

There's not stderr, it's just execve which is failing with errno set to ENOENT.
Now, if you wonder how bash manages to print this "bad interpreter" error 
message, it's simple: it first checks for common errno values (ENOEXEC, 
ENOMEM), and then it parses the shebang: if it finds a line starting with #!, 
it assumes that it's a bad interpreter, and prints the offending line.
That's it.

Suggesting to close as invalid.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue12235>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to