Behaviour of subprocess.Popen, ssh and nohup I don't understand

Dan Stromberg drsalists at gmail.com
Wed Apr 6 13:43:19 EDT 2011


On Wed, Apr 6, 2011 at 12:47 AM, Adriaan Renting <renting at astron.nl> wrote:
>
>
> This solves the problem using stdin=open(os.devnull, 'rb') instead of
> stdin=None makes it run even if there is input from stdin in the
> foreground process.
>
> The operating system is Ubuntu 8.04
> I understood what Suspended (tty input) means. I don't understand why
> it waits for input if stdin=None.
>
> Thank you for your help.
>
> Adriaan Renting.
> --
> http://mail.python.org/mailman/listinfo/python-list

http://docs.python.org/library/subprocess.html
"With None, no redirection will occur; the child’s file handles will
be inherited from the parent."

When a background process reads from a tty (which is most likely what
its inherited stdin is connected to), it gets a SIGTTIN, suspending
your background process.

See also "ssh -n".



More information about the Python-list mailing list