[issue27068] Add a detach() method to subprocess.Popen

Martin Panter report at bugs.python.org
Fri May 20 08:54:50 EDT 2016


Martin Panter added the comment:

One potential way to fix Issue 27069 (leave a webbrowser running in the background) might be to use a detach() method. Pseudocode:

launcher = """\
import subprocess, sys
proc = subprocess.Popen(sys.argv)

# Popen object gives up “ownership” of child.
# Caller exits straight afterwards, letting the OS take care of monitoring the child.
proc.detach()
"""

def open_firefox(url):
    cmd = (sys.executable, "-c", launcher, "firefox", url)
    subprocess.check_call(cmd)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27068>
_______________________________________


More information about the Python-bugs-list mailing list