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:
parent
2ced87f3e6
commit
feac3980ce
|
@ -159,10 +159,8 @@ class BackgroundBrowser(GenericBrowser):
|
||||||
if sys.platform[:3] == 'win':
|
if sys.platform[:3] == 'win':
|
||||||
p = subprocess.Popen(cmdline)
|
p = subprocess.Popen(cmdline)
|
||||||
else:
|
else:
|
||||||
setsid = getattr(os, 'setsid', None)
|
p = subprocess.Popen(cmdline, close_fds=True,
|
||||||
if not setsid:
|
start_new_session=True)
|
||||||
setsid = getattr(os, 'setpgrp', None)
|
|
||||||
p = subprocess.Popen(cmdline, close_fds=True, preexec_fn=setsid)
|
|
||||||
return (p.poll() is None)
|
return (p.poll() is None)
|
||||||
except OSError:
|
except OSError:
|
||||||
return False
|
return False
|
||||||
|
@ -321,11 +319,6 @@ class Konqueror(BaseBrowser):
|
||||||
action = "openURL"
|
action = "openURL"
|
||||||
|
|
||||||
devnull = subprocess.DEVNULL
|
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:
|
try:
|
||||||
p = subprocess.Popen(["kfmclient", action, url],
|
p = subprocess.Popen(["kfmclient", action, url],
|
||||||
|
@ -343,7 +336,7 @@ class Konqueror(BaseBrowser):
|
||||||
p = subprocess.Popen(["konqueror", "--silent", url],
|
p = subprocess.Popen(["konqueror", "--silent", url],
|
||||||
close_fds=True, stdin=devnull,
|
close_fds=True, stdin=devnull,
|
||||||
stdout=devnull, stderr=devnull,
|
stdout=devnull, stderr=devnull,
|
||||||
preexec_fn=setsid)
|
start_new_session=True)
|
||||||
except OSError:
|
except OSError:
|
||||||
# fall through to next variant
|
# fall through to next variant
|
||||||
pass
|
pass
|
||||||
|
@ -356,7 +349,7 @@ class Konqueror(BaseBrowser):
|
||||||
p = subprocess.Popen(["kfm", "-d", url],
|
p = subprocess.Popen(["kfm", "-d", url],
|
||||||
close_fds=True, stdin=devnull,
|
close_fds=True, stdin=devnull,
|
||||||
stdout=devnull, stderr=devnull,
|
stdout=devnull, stderr=devnull,
|
||||||
preexec_fn=setsid)
|
start_new_session=True)
|
||||||
except OSError:
|
except OSError:
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -27,6 +27,9 @@ Core and Builtins
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- The webbrowser module now uses subprocess's start_new_session=True rather
|
||||||
|
than a potentially risky preexec_fn=os.setsid call.
|
||||||
|
|
||||||
- Issue #22236: Fixed Tkinter images copying operations in NoDefaultRoot mode.
|
- Issue #22236: Fixed Tkinter images copying operations in NoDefaultRoot mode.
|
||||||
|
|
||||||
- Issue #22191: Fix warnings.__all__.
|
- Issue #22191: Fix warnings.__all__.
|
||||||
|
|
Loading…
Reference in New Issue