Skip to content

Instantly share code, notes, and snippets.

@blythest
Created April 3, 2017 22:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blythest/6cd30bc5fc5953739b6d763801d94e97 to your computer and use it in GitHub Desktop.
Save blythest/6cd30bc5fc5953739b6d763801d94e97 to your computer and use it in GitHub Desktop.
import os
import sys
def main(command):
pid = os.fork()
if 0 != pid:
return
sys.stdin.close()
sys.stdout.close()
sys.stderr.close()
os.setsid()
pid = os.fork()
if 0 != pid:
return
os.system(command)
sys.exit()
if __name__ == "__main__":
main(sys.argv[1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment