mirror of
https://github.com/python/cpython.git
synced 2025-08-22 09:45:06 +00:00
#15447: Use subprocess.DEVNULL in webbrowser, instead of opening
This eliminates a ResourceWarning, since before webbrowser was explicitly opening os.devnull and then leaving it open. Tests to follow. Patch by Anton Barkovsky.
This commit is contained in:
parent
d674a770e9
commit
02ca144b92
2 changed files with 5 additions and 2 deletions
|
@ -230,7 +230,7 @@ class UnixBrowser(BaseBrowser):
|
|||
cmdline = [self.name] + raise_opt + args
|
||||
|
||||
if remote or self.background:
|
||||
inout = io.open(os.devnull, "r+")
|
||||
inout = subprocess.DEVNULL
|
||||
else:
|
||||
# for TTY browsers, we need stdin/out
|
||||
inout = None
|
||||
|
@ -354,7 +354,7 @@ class Konqueror(BaseBrowser):
|
|||
else:
|
||||
action = "openURL"
|
||||
|
||||
devnull = io.open(os.devnull, "r+")
|
||||
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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue