mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-19 06:54:58 +02:00
Allow the diff kitten to work even if stdout/stdin are redirected
Now directly opens /dev/tty
This commit is contained in:
@@ -399,6 +399,11 @@ def main(args):
|
|||||||
opts = init_config(args)
|
opts = init_config(args)
|
||||||
set_diff_command(opts.diff_cmd)
|
set_diff_command(opts.diff_cmd)
|
||||||
lines_for_path.replace_tab_by = opts.replace_tab_by
|
lines_for_path.replace_tab_by = opts.replace_tab_by
|
||||||
|
# Ensure the kitten works even when stdin/stdout are redirected
|
||||||
|
if not sys.stdin.isatty():
|
||||||
|
sys.stdin = open('/dev/tty')
|
||||||
|
if not sys.stdout.isatty():
|
||||||
|
sys.stdout = open('/dev/tty', 'w')
|
||||||
|
|
||||||
loop = Loop()
|
loop = Loop()
|
||||||
handler = DiffHandler(args, opts, left, right)
|
handler = DiffHandler(args, opts, left, right)
|
||||||
|
|||||||
Reference in New Issue
Block a user