mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-03 23:11:14 -03:00
fish_key_reader: reuse isatty helper
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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()`].
|
||||
|
||||
Reference in New Issue
Block a user