mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
The webbrowser module now uses subprocess's start_new_session=True rather
than a potentially risky preexec_fn=os.setsid call.
This commit is contained in:
commit
a232613679
2 changed files with 7 additions and 11 deletions
|
@ -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:
|
||||
|
|
|
@ -124,6 +124,9 @@ Core and Builtins
|
|||
Library
|
||||
-------
|
||||
|
||||
- The webbrowser module now uses subprocess's start_new_session=True rather
|
||||
than a potentially risky preexec_fn=os.setsid call.
|
||||
|
||||
- Issue #22042: signal.set_wakeup_fd(fd) now raises an exception if the file
|
||||
descriptor is in blocking mode.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue