Skip to content

Commit

Permalink
fix: stdin behavior
Browse files Browse the repository at this point in the history
The issue is that eza ignores the `--stdin` argument, unless there is
data piped into it. This is not how stdin behavior is supposed to work.
e.g. look at the `cat` command.
The flag should tell eza that the input is read from stdin. But if you
call `eza --stdin` nothing is read from stdin.

This means that the current argument is moot and serves no purpose,
because eza already has the capability of checking whether data is
piped into it.
So eza behaves like this: if you pipe data into eza, eza will ignore
the data, unless you additionally specify `--stdin`
This makes no sense.
Besides, what else is eza supposed to read when data is piped into it?
  • Loading branch information
tessus authored and cafkafk committed Jan 22, 2025
1 parent 72c2c74 commit a3ba3e8
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/options/stdin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ pub enum FilesInput {
impl FilesInput {
pub fn deduce<V: Vars>(matches: &MatchedFlags<'_>, vars: &V) -> Result<Self, OptionsError> {
Ok(
if io::stdin().is_terminal() || !matches.has(&flags::STDIN)? {
FilesInput::Args
} else if matches.has(&flags::STDIN)? && !io::stdin().is_terminal() {
if matches.has(&flags::STDIN)? || !io::stdin().is_terminal() {
let separator = vars
.get(EZA_STDIN_SEPARATOR)
.unwrap_or(OsString::from("\n"));
Expand Down

0 comments on commit a3ba3e8

Please sign in to comment.