Diez B. Roggisch
deets at nospam.web.de
Fri Jul 24 18:35:56 CEST 2009
> Yes I mean subprocess.Popen.
> I was wondering the meaning of "asynchronously"
> Here is some code I am reading recently:
> result = Popen(cmdline,shell=True,stdout=PIPE).stdout
> for line in result.readlines():
> if find(line,"Cross") != -1:
> return float(split(line)[-1][0:-1])
> The computation in the program "cmdline" takes a long time, at the end of which the results will be output to stdout.
> "asynchronous" seems to mean Popen returns to the parent process immediately and the parent and child processes continue to be executed.
> However, if Popen returns immediately to the parent process, then there will be nothing in "result", not to mention extracting information from the output. Thus it seems to me the parent process has to wait till the child process finish.
> So how to understand the meaning of "asynchronous"?
"Asynchronous" means asynchronous - the parent is *not* waiting.
Which is the reason that there is (amongst other things) the
"wait"-method you can call to wait for the child to be terminated.
More information about the Python-list