From 70a18a94861f4493f595e07395508289efbc4e1d Mon Sep 17 00:00:00 2001 From: alexzorin Date: Wed, 8 Sep 2021 01:38:27 +1000 Subject: [PATCH] disable donation prompt during --quiet (#9022) Issuing a certificate with --quiet was crashing during the donation atexit call because it was trying to use the /dev/null fd after the displayer context manager had already closed it. --- certbot/CHANGELOG.md | 1 + certbot/certbot/_internal/main.py | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/certbot/CHANGELOG.md b/certbot/CHANGELOG.md index 463d8f3b5..1ad4a2076 100644 --- a/certbot/CHANGELOG.md +++ b/certbot/CHANGELOG.md @@ -27,6 +27,7 @@ Certbot adheres to [Semantic Versioning](https://semver.org/). ### Fixed * Fixed parsing of `Define`d values in the Apache plugin to allow for `=` in the value. +* Fixed a relatively harmless crash when issuing a certificate with `--quiet`/`-q`. More details about these changes can be found on our GitHub repo. diff --git a/certbot/certbot/_internal/main.py b/certbot/certbot/_internal/main.py index cda08e1b7..659d00888 100644 --- a/certbot/certbot/_internal/main.py +++ b/certbot/certbot/_internal/main.py @@ -66,9 +66,12 @@ def _suggest_donation_if_appropriate(config): :rtype: None """ + # don't prompt for donation if: + # - renewing + # - using the staging server (--staging or --dry-run) + # - running with --quiet (display fd won't be available during atexit calls #8995) assert config.verb != "renew" - if config.staging: - # --dry-run implies --staging + if config.staging or config.quiet: return util.atexit_register( display_util.notification,