Kevin Barry added the comment:

emmanuel,

Thanks for the suggestion. Your workaround is exactly the same as using dup2 
(in C) to replace stdin/stdout/stderr with the pty, however. If you added the 
following lines to your C code, it would have the same effect as the 
command-line redirection in the workaround:

dup2(fileno(file), STDIN_FILENO);
dup2(fileno(file), STDOUT_FILENO);
dup2(fileno(file), STDERR_FILENO);

In fact, that's exactly what bash does after forking, just before executing 
"exe". In most cases, developers who use PyRun_InteractiveLoop in a pty 
probably also do exactly that, which is why I'm the only one who's reported 
this as a bug. For applications like mine, however, where the interactive 
Python session needs to be an unobtrusive add-on to an otherwise-complete 
program, this solution won't work. The standard file descriptors aren't 
disposable in most of the programs I work on.

Thanks again!

Kevin Barry

----------

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

Reply via email to