Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve warning message when stdin is not a terminal #374

Merged
merged 1 commit into from
Oct 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions internal/filewatcher/term_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,16 @@ func newTerminal() *terminal {
}

// Start the terminal is non-blocking read mode. The terminal can be reset to
// normal mode by calling Reset.
// normal mode by calling Reset. If os.Stdin is not a terminal or cannot use
// non-blocking reads then a warning is logged and the terminal is not reset.
func (r *terminal) Start() {
if r == nil {
return
}
fd := int(os.Stdin.Fd())
reset, err := enableNonBlockingRead(fd)
if err != nil {
log.Warnf("failed to put terminal (fd %d) into raw mode: %v", fd, err)
log.Warnf("no terminal input -- keyboard shortcuts disabled: %v", err)
return
}
r.reset = reset
Expand Down