Skip to content

Instantly share code, notes, and snippets.

@shiweifu
Created September 5, 2012 03:25
Show Gist options
  • Save shiweifu/3629849 to your computer and use it in GitHub Desktop.
Save shiweifu/3629849 to your computer and use it in GitHub Desktop.
fork process
#!/usr/bin/env python
#coding: utf-8
#author: shiweifu
#mail : [email protected]
import os
def fork_process(cmd, args, env):
child_pid = os.fork()
if child_pid == 0:
os.execvpe(cmd, args, env)
#usage:
fork_process("ls", ["."], os.environ)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment