SHARE
TWEET

Untitled

a guest Jun 16th, 2019 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. kwargs = {}
  2. if platform.system() == 'Windows':
  3.     # from msdn [1]
  4.     CREATE_NEW_PROCESS_GROUP = 0x00000200  # note: could get it from subprocess
  5.     DETACHED_PROCESS = 0x00000008          # 0x8 | 0x200 == 0x208
  6.     kwargs.update(creationflags=DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP)
  7.     kwargs.update(stderr=subprocess.PIPE)
  8. elif sys.version_info < (3, 2):  # assume posix
  9.     kwargs.update(preexec_fn=os.setsid)
  10. else:  # Python 3.2+ and Unix
  11.     kwargs.update(start_new_session=True)
  12.  
  13. subprocess.Popen([APP], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE,**kwargs)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top