diff --git a/src/builtins/fish_key_reader.rs b/src/builtins/fish_key_reader.rs index a899b8ed8..a7c61daca 100644 --- a/src/builtins/fish_key_reader.rs +++ b/src/builtins/fish_key_reader.rs @@ -257,7 +257,7 @@ pub fn fish_key_reader( return s; } - if streams.stdin_fd < 0 || unsafe { libc::isatty(streams.stdin_fd) } == 0 { + if streams.stdin_fd < 0 || !isatty(streams.stdin_fd) { streams.err.appendln("Stdin must be attached to a tty."); return Err(STATUS_CMD_ERROR); } diff --git a/src/nix.rs b/src/nix.rs index 8c9a97d5c..18712ca29 100644 --- a/src/nix.rs +++ b/src/nix.rs @@ -41,7 +41,7 @@ pub fn getpid() -> i32 { pub fn isatty(fd: i32) -> bool { // This returns false if the fd is valid but not a tty, or is invalid. // No place we currently call it really cares about the difference. - return unsafe { libc::isatty(fd) } == 1; + (unsafe { libc::isatty(fd) }) == 1 } /// An enumeration of supported libc rusage types used by [`getrusage()`].