Skip to content

Commit

Permalink
fixup! Rework tail plateform module to tackle uutils#2873
Browse files Browse the repository at this point in the history
  • Loading branch information
anastygnome committed Jul 8, 2022
1 parent f20c50c commit 9ad16c3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/uu/tail/src/platform/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* file that was distributed with this source code.
*/

// spell-checker:ignore (ToDO) stdlib
// spell-checker:ignore (ToDO) stdlib, ISCHR,ISREG,ISFIFO
// spell-checker:ignore (options) GETFD EPERM ENOSYS

use std::io::{stdin, Error};
Expand All @@ -17,7 +17,7 @@ use std::os::unix::prelude::AsRawFd;

use nix::sys::stat::fstat;

use libc::{S_IFIFO, S_IFSOCK};
use libc::{S_IFIFO, S_IFREG, S_IFSOCK};

pub type Pid = libc::pid_t;

Expand Down Expand Up @@ -58,7 +58,9 @@ pub fn stdin_is_pipe_or_fifo() -> bool {
Ok(stat) => {
let mode = stat.st_mode as libc::mode_t;
// NOTE: This is probably not the most correct way to check this
(mode & S_IFIFO != 0) || (mode & S_IFSOCK != 0)
(mode & S_IFIFO != 0)
|| ((cfg!(target_os = "macos")) && (mode & S_IFSOCK != 0))
|| (!(cfg!(target_os = "macos")) && (mode & S_IFREG != 0))
}
Err(err) => panic!("{}", err),
}
Expand Down

0 comments on commit 9ad16c3

Please sign in to comment.