Make the icat kitten work even if stdout/stdin are redirected
This commit is contained in:
parent
8a1a45b067
commit
c76a8242e2
@ -264,10 +264,8 @@ def main(args=sys.argv):
|
|||||||
print('{}x{}'.format(ss.width, ss.height), end='')
|
print('{}x{}'.format(ss.width, ss.height), end='')
|
||||||
raise SystemExit(0)
|
raise SystemExit(0)
|
||||||
|
|
||||||
if not sys.stdout.isatty() or not sys.stdin.isatty():
|
if not sys.stdout.isatty():
|
||||||
raise SystemExit(
|
sys.stdout = open('/dev/tty', 'w')
|
||||||
'Must be run in a terminal, stdout and/or stdin is currently not a terminal'
|
|
||||||
)
|
|
||||||
screen_size = screen_size_function()
|
screen_size = screen_size_function()
|
||||||
signal.signal(signal.SIGWINCH, lambda signum, frame: setattr(screen_size, 'changed', True))
|
signal.signal(signal.SIGWINCH, lambda signum, frame: setattr(screen_size, 'changed', True))
|
||||||
if screen_size().width == 0:
|
if screen_size().width == 0:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user