From 9442835ddbbd18cb66cef364bf3d7beaf0c2ef3c Mon Sep 17 00:00:00 2001 From: Goffi Date: Fri, 4 Jun 2021 15:23:24 +0200 Subject: [PATCH] jp: fix background guessing when stdin is redirected --- sat_frontends/jp/base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sat_frontends/jp/base.py b/sat_frontends/jp/base.py index 7342badb..88c17c1c 100644 --- a/sat_frontends/jp/base.py +++ b/sat_frontends/jp/base.py @@ -120,7 +120,7 @@ class LiberviaCli: return config.getConfig(self.sat_conf, section, name, default=default) def guess_background(self): - if not sys.stdout.isatty(): + if not sys.stdin.isatty() or not sys.stdout.isatty(): return 'dark' stdin_fd = sys.stdin.fileno() old_settings = termios.tcgetattr(stdin_fd) @@ -155,7 +155,7 @@ class LiberviaCli: if background not in ('dark', 'light'): raise exceptions.ConfigError(_( f'Invalid value set for "background" ({background!r}), please check ' - f'your settings in sat.conf')) + f'your settings in libervia.conf')) if background == 'light': C.A_HEADER = A.FG_MAGENTA C.A_SUBHEADER = A.BOLD + A.FG_RED