contrib/firefox/0007-bmo-878089-Don-t-fail-when-TERM-is-not-set.patch
2022-09-19 22:37:26 +10:00

37 lines
1.5 KiB
Diff

From e43f7431036904989cfd520f19de28a72be97ad9 Mon Sep 17 00:00:00 2001
From: Thomas Deutschmann <whissi@gentoo.org>
Date: Mon, 6 Apr 2020 19:41:43 +0200
Subject: [PATCH 08/30] bmo#878089: Don't fail when TERM is not set
Link: https://github.com/erikrose/blessings/pull/137
Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=878089
Bug: https://bugs.gentoo.org/654316
Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
---
third_party/python/blessings/blessings/__init__.py | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/third_party/python/blessings/blessings/__init__.py b/third_party/python/blessings/blessings/__init__.py
index 388cece0b8..1283460cc9 100644
--- a/third_party/python/blessings/blessings/__init__.py
+++ b/third_party/python/blessings/blessings/__init__.py
@@ -94,8 +94,13 @@ class Terminal(object):
# init sequences to the stream if it has a file descriptor, and
# send them to stdout as a fallback, since they have to go
# somewhere.
- setupterm(kind or environ.get('TERM', 'unknown'),
- self._init_descriptor)
+ try:
+ setupterm(kind or environ.get('TERM', 'dumb') or 'dumb',
+ self._init_descriptor)
+ except curses.error:
+ # There was an error setting up the terminal, either curses is
+ # not supported or TERM is incorrectly set. Fall back to dumb.
+ self._does_styling = False
self.stream = stream
--
2.34.1