os.fork
Fredrik Lundh
fredrik at pythonware.com
Wed Sep 1 04:12:59 EDT 1999
Curtis, Craig M. <curtis_c at lxe.com> wrote:
> Is there a compatible way to fork processes in Python that works in both a
> Linux environment and Win32?
>
> It seems the win32 port does not support os.fork.
not yet. but assuming what you're really looking
for is fork+exec, you can use os.spawn (windows
only).
here's an example (you have to fill in the blanks
yourself):
def spawn(...):
try:
status = os.spawn(...)
except NameError:
# assume it's unix
pid = os.fork()
if pid == 0:
os.exec(...)
status = os.wait()[0]
return status
</F>
More information about the Python-list
mailing list