mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-08 22:28:24 +02:00
diff kitten: Better error message when one of the arguments does not exist
This commit is contained in:
@@ -399,11 +399,9 @@ 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
|
for f in left, right:
|
||||||
if not sys.stdin.isatty():
|
if not os.path.exists(f):
|
||||||
sys.stdin = open('/dev/tty')
|
raise SystemExit('{} does not exist'.format(f))
|
||||||
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