[issue12235] subprocess loses stderr information when _execute_child fails
report at bugs.python.org
Wed Jun 1 19:34:47 CEST 2011
Charles-François Natali <neologix at 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
$ 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.
Suggesting to close as invalid.
Python tracker <report at bugs.python.org>
More information about the Python-bugs-list