# HG changeset patch # User Goffi # Date 1622813004 -7200 # Node ID 1ac5570fa998b19c7045e6f7a983273dc9eb4a79 # Parent 185601bc0cd3e060671cf54acd32b8c2c911fb2b jp: fix background guessing when stdin is redirected diff -r 185601bc0cd3 -r 1ac5570fa998 sat_frontends/jp/base.py --- a/sat_frontends/jp/base.py Fri Jun 04 14:44:33 2021 +0200 +++ b/sat_frontends/jp/base.py Fri Jun 04 15:23:24 2021 +0200 @@ -120,7 +120,7 @@ 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 @@ 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