diff options
author | Gregory P. Smith <greg@krypto.org> | 2014-08-27 09:34:38 -0700 |
---|---|---|
committer | Gregory P. Smith <greg@krypto.org> | 2014-08-27 09:34:38 -0700 |
commit | feac3980ced0d80dc21982d87658876644c60e72 (patch) | |
tree | fd2a9e5b390400156487a63858ec09350f3fd169 /Lib/webbrowser.py | |
parent | Issue #22065: Remove the now unsed configGUI menu parameter and arguments. (diff) | |
download | cpython-feac3980ced0d80dc21982d87658876644c60e72.tar.gz cpython-feac3980ced0d80dc21982d87658876644c60e72.tar.bz2 cpython-feac3980ced0d80dc21982d87658876644c60e72.zip |
The webbrowser module now uses subprocess's start_new_session=True rather
than a potentially risky preexec_fn=os.setsid call.
Diffstat (limited to 'Lib/webbrowser.py')
-rwxr-xr-x | Lib/webbrowser.py | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/Lib/webbrowser.py b/Lib/webbrowser.py index 9e47084a91b..845f1d004c0 100755 --- a/Lib/webbrowser.py +++ b/Lib/webbrowser.py @@ -159,10 +159,8 @@ class BackgroundBrowser(GenericBrowser): if sys.platform[:3] == 'win': p = subprocess.Popen(cmdline) else: - setsid = getattr(os, 'setsid', None) - if not setsid: - setsid = getattr(os, 'setpgrp', None) - p = subprocess.Popen(cmdline, close_fds=True, preexec_fn=setsid) + p = subprocess.Popen(cmdline, close_fds=True, + start_new_session=True) return (p.poll() is None) except OSError: return False @@ -321,11 +319,6 @@ class Konqueror(BaseBrowser): action = "openURL" devnull = subprocess.DEVNULL - # if possible, put browser in separate process group, so - # keyboard interrupts don't affect browser as well as Python - setsid = getattr(os, 'setsid', None) - if not setsid: - setsid = getattr(os, 'setpgrp', None) try: p = subprocess.Popen(["kfmclient", action, url], @@ -343,7 +336,7 @@ class Konqueror(BaseBrowser): p = subprocess.Popen(["konqueror", "--silent", url], close_fds=True, stdin=devnull, stdout=devnull, stderr=devnull, - preexec_fn=setsid) + start_new_session=True) except OSError: # fall through to next variant pass @@ -356,7 +349,7 @@ class Konqueror(BaseBrowser): p = subprocess.Popen(["kfm", "-d", url], close_fds=True, stdin=devnull, stdout=devnull, stderr=devnull, - preexec_fn=setsid) + start_new_session=True) except OSError: return False else: |