bpo-29644: suppress subprocess output from webbrowser (#289) · python/cpython@140792b (original) (raw)
Navigation Menu
- GitHub Copilot Write better code with AI
- GitHub Models New Manage and compare prompts
- GitHub Advanced Security Find and fix vulnerabilities
- Actions Automate any workflow
- Codespaces Instant dev environments
- Issues Plan and track work
- Code Review Manage code changes
- Discussions Collaborate outside of code
- Code Search Find more, search less
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Appearance settings
Commit 140792b
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.
File tree
1 file changed
lines changed
1 file changed
lines changed
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -491,7 +491,8 @@ def register_X_browsers(): | ||
491 | 491 | if os.environ.get("DISPLAY"): |
492 | 492 | try: |
493 | 493 | cmd = "xdg-settings get default-web-browser".split() |
494 | -result = subprocess.check_output(cmd).decode().strip() | |
494 | +raw_result = subprocess.check_output(cmd, stderr=subprocess.DEVNULL) | |
495 | +result = raw_result.decode().strip() | |
495 | 496 | except (FileNotFoundError, subprocess.CalledProcessError): |
496 | 497 | pass |
497 | 498 | else: |