subprocess call is not waiting.

andrea crotti andrea.crotti.0 at gmail.com
Wed Sep 19 06:26:30 EDT 2012


2012/9/18 Dennis Lee Bieber <wlfraed at ix.netcom.com>:
>
>         Unless you have a really massive result set from that "ls", that
> command probably ran so fast that it is blocked waiting for someone to
> read the PIPE.

I tried also with "ls -lR /" and that definitively takes a while to run,
when I do this:

proc = subprocess.Popen(['ls', '-lR', '/'], stdout=subprocess.PIPE,
stderr=subprocess.PIPE)

nothing is running, only when I actually do
proc.communicate()

I see the process running in top..
Is it still an observation problem?

Anyway I also need to know when the process is over while waiting, so
probably a thread is the only way..



More information about the Python-list mailing list