Allow the diff kitten to work even if stdout/stdin are redirected
Now directly opens /dev/tty
This commit is contained in:
parent
8f433f5ff6
commit
8a1a45b067
@ -399,6 +399,11 @@ def main(args):
|
||||
opts = init_config(args)
|
||||
set_diff_command(opts.diff_cmd)
|
||||
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()
|
||||
handler = DiffHandler(args, opts, left, right)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user