From c76a8242e28ee51a58e33b0a785a13e98efca19c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 6 Jun 2018 12:04:10 +0530 Subject: [PATCH] Make the icat kitten work even if stdout/stdin are redirected --- kittens/icat/main.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/kittens/icat/main.py b/kittens/icat/main.py index ca17032d5..3e82a88c1 100755 --- a/kittens/icat/main.py +++ b/kittens/icat/main.py @@ -264,10 +264,8 @@ def main(args=sys.argv): print('{}x{}'.format(ss.width, ss.height), end='') raise SystemExit(0) - if not sys.stdout.isatty() or not sys.stdin.isatty(): - raise SystemExit( - 'Must be run in a terminal, stdout and/or stdin is currently not a terminal' - ) + if not sys.stdout.isatty(): + sys.stdout = open('/dev/tty', 'w') screen_size = screen_size_function() signal.signal(signal.SIGWINCH, lambda signum, frame: setattr(screen_size, 'changed', True)) if screen_size().width == 0: