Using subprocess module to launch a shell shell script that itself forks a process

Samuel A. Falvo II sam.falvo at gmail.com
Wed Oct 8 14:31:40 EDT 2008


On Oct 8, 11:24 am, "Samuel A. Falvo II" <sam.fa... at gmail.com> wrote:
> It does not expect input from stdin.  However, this does not affect
> any OTHER scripts or commands I run.

OK, so, I'm very confused as to why this would matter.

I removed the stdin=PIPE argument, and this works.  Many thanks for
bringing this to my attention.

But, my question now is, WHY is this an issue?  If the launched
process doesn't read from its stdin, why would it block?  Hence my
question here:

> Let's remember to look at the objective facts: for shell scripts that
> launch child processes of their own, Python hangs.  For all other
> types of commands, it works 100% as expected.

Meaning, if I launched the Java process directly, it works fine.  If I
launch it from the shell script WITHOUT background execution, it works
fine.  But when I launch it WITH background execution (e.g., with the
& suffix), then it blocks.

Any ideas, so I can write this into my log for future reference?

Thanks.




More information about the Python-list mailing list