From 4456dd6f59a7c84cd99e6c5afae5c2738986f133 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Tue, 10 Nov 2020 22:29:52 -0300 Subject: [PATCH] catch stderr when running git subprocess outside of a git repo. --- lnbits/settings.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lnbits/settings.py b/lnbits/settings.py index 2847ed5a..1ce46ec2 100644 --- a/lnbits/settings.py +++ b/lnbits/settings.py @@ -30,6 +30,13 @@ PREFER_SECURE_URLS = env.bool("LNBITS_FORCE_HTTPS", default=True) SERVICE_FEE = env.float("LNBITS_SERVICE_FEE", default=0.0) try: - LNBITS_COMMIT = subprocess.check_output(["git", "-C", LNBITS_PATH, "rev-parse", "HEAD"]).strip().decode("ascii") + LNBITS_COMMIT = ( + subprocess.check_output( + ["git", "-C", LNBITS_PATH, "rev-parse", "HEAD"], + stderr=subprocess.DEVNULL, + ) + .strip() + .decode("ascii") + ) except: LNBITS_COMMIT = "unknown"