subprocess.Popen not replacing current process?

goodman goodman.m.w at gmail.com
Thu Nov 4 19:53:03 EDT 2010


On Nov 4, 4:43 pm, Lawrence D'Oliveiro <l... at geek-
central.gen.new_zealand> wrote:
> In message
> <0f1a17f4-b6a9-4e89-ac26-74b1098a0... at b19g2000prj.googlegroups.com>, goodman
> wrote:
>
> > Hi, I'm wondering why subprocess.Popen does not seem to replace the
> > current process, even when it uses os.execvp (according to the
> > documentation:
> >http://docs.python.org/library/subprocess.html#subprocess.Popen).
>
> You’ll notice that in the list at the top of the functions that subprocess
> replaces, there are no os.exec* entries. subprocess is only for spawning new
> processes; if all you need to do is an exec, do an exec
> <http://docs.python.org/library/os.html#process-management>; subprocess
> can’t offer anything to make that any simpler.

Thanks Lawrence. Forgive my recent followup, as I posted it before I
saw your message. I noticed that the exec*s were not replaced by
subprocess, so that makes sense to just use exec. Though I'm still a
little confused how, if subprocess.Popen is using os.execvp, it still
maintains control of things like interrupts.

Anyway, my problem is solved. Thanks!



More information about the Python-list mailing list