Avoid lockup when running without arguments and stdin is connected to a tty#1112
Merged
dandavison merged 1 commit intodandavison:masterfrom Jun 22, 2022
dotdash:fix_lockup_on_no_args
Merged
Avoid lockup when running without arguments and stdin is connected to a tty#1112dandavison merged 1 commit intodandavison:masterfrom dotdash:fix_lockup_on_no_args
dandavison merged 1 commit intodandavison:masterfrom
dotdash:fix_lockup_on_no_args
Conversation
… tty Up until commit 55287a8 "Run in diff mode iff two positional arguments are supplied" diff mode was only supported when stdin is connected to a tty, which meant that, for example, running `delta a b` in a git hook would do the wrong thing. As a fix, the tty check was removed, so now `delta a b` always works, but the only error condition is now to pass only a single file. When passing no files at all, we try parse to stdin even when connected to a tty. Usually that wouldn't be that bad, because the user could press Ctrl-C or Ctrl-D (EOF) to quit, unfortunately something in the pager setup breaks this, and the only way to exit `delta` is to kill it. Running `delta` with stdin connected to a tty would mean that the user has to manually enter a diff (or paste it), which is not really an expected scenario, as demonstrated by the error message that's currently only emitted when running `delta` with only a single file argument. So we can avoid the lockup by also emitting the error message when running on a tty and there are no files to be diffed. Fixes #1039, fixes #1090
Owner
|
Thanks a lot, LGTM! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Up until commit 55287a8 "Run in diff mode iff two positional arguments
are supplied" diff mode was only supported when stdin is connected to a
tty, which meant that, for example, running
delta a bin a git hookwould do the wrong thing.
As a fix, the tty check was removed, so now
delta a balways works,but the only error condition is now to pass only a single file. When
passing no files at all, we try parse to stdin even when connected to a
tty. Usually that wouldn't be that bad, because the user could press
Ctrl-C or Ctrl-D (EOF) to quit, unfortunately something in the pager
setup breaks this, and the only way to exit
deltais to kill it.Running
deltawith stdin connected to a tty would mean that the userhas to manually enter a diff (or paste it), which is not really an
expected scenario, as demonstrated by the error message that's currently
only emitted when running
deltawith only a single file argument. Sowe can avoid the lockup by also emitting the error message when running
on a tty and there are no files to be diffed.
Fixes #1039, fixes #1090