summaryrefslogtreecommitdiffstats
path: root/Lib/webbrowser.py
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2017-02-25 08:40:07 (GMT)
committerGitHub <noreply@github.com>2017-02-25 08:40:07 (GMT)
commit140792bd514ee4ba739fda899785bea3ce746f05 (patch)
tree42b9b25acdf62fa91c6daae03259e210bec13e5c /Lib/webbrowser.py
parent56a8eccc43c66ae51c5a6bfc89635b1998fd419e (diff)
downloadcpython-140792bd514ee4ba739fda899785bea3ce746f05.zip
cpython-140792bd514ee4ba739fda899785bea3ce746f05.tar.gz
cpython-140792bd514ee4ba739fda899785bea3ce746f05.tar.bz2
bpo-29644: suppress subprocess output from webbrowser (#289)
When checking for the default X web browser, xdg-settings may emit messages on stderr if some components (such as kreadconfig5) are unavailable. These messages aren't of interest to Python, so we just ignore them.
Diffstat (limited to 'Lib/webbrowser.py')
-rwxr-xr-xLib/webbrowser.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/webbrowser.py b/Lib/webbrowser.py
index a9eac69..fb6c83b 100755
--- a/Lib/webbrowser.py
+++ b/Lib/webbrowser.py
@@ -491,7 +491,8 @@ def register_X_browsers():
if os.environ.get("DISPLAY"):
try:
cmd = "xdg-settings get default-web-browser".split()
- result = subprocess.check_output(cmd).decode().strip()
+ raw_result = subprocess.check_output(cmd, stderr=subprocess.DEVNULL)
+ result = raw_result.decode().strip()
except (FileNotFoundError, subprocess.CalledProcessError):
pass
else: