(executable, *args, writer=None)
| 37 | |
| 38 | |
| 39 | def _start_detached(executable, *args, writer=None): |
| 40 | # Configure Launch |
| 41 | kwargs = {} |
| 42 | if platform.system() == "Windows": |
| 43 | kwargs.update( |
| 44 | creationflags=DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP |
| 45 | ) |
| 46 | else: |
| 47 | kwargs.update(start_new_session=True) |
| 48 | p = Popen( |
| 49 | [executable, *args], stdin=PIPE, stdout=PIPE, stderr=PIPE, **kwargs |
| 50 | ) |
| 51 | # Send pid to pipe |
| 52 | writer.send(p.pid) |
| 53 | sys.exit() |
| 54 | |
| 55 | |
| 56 | def _cleanup(): |