Launching a subprocess without waiting around for the result?
bignose+hates-spam at benfinney.id.au
Fri Sep 19 03:22:08 CEST 2008
erikcw <erikwickstrom at gmail.com> writes:
> On Sep 18, 3:33 pm, Ben Finney <bignose+hates-s... at benfinney.id.au>
> > erikcw <erikwickst... at gmail.com> writes:
> > > What is the correct way to launch subprocess without waiting for
> > > the result to return?
> > Creating an instance of 'subprocess.Popen' will launch the process
> > and return the Popen instance. You then have the option of polling
> > it or waiting for it to complete.
> So if I create a Popen object and then just ignore the object and
> exit the program the subproccess will finish it's work and then exit
> itself cleanly?
Ah, no, that's a different thing. If the parent exits, the child will
also be killed I believe.
If you want to spawn a process and have it live on independent of the
parent, you want to make the child process a "daemon", detatching
itself from the parent's environment. I don't recall how that's done
immediately, but those are the terms to search for.
\ “Pinky, are you pondering what I'm pondering?” “Yes Brain, but |
`\ if our knees bent the other way, how would we ride a bicycle?” |
_o__) —_Pinky and The Brain_ |
More information about the Python-list