Repository: sharkdp/bat (language: rust)

Issue:
regression: bat fails to page - will not read from stdin if no file (or `-`) specified
`bat` (no longer) reads from `stdin` if no file or `-` is specified. This breaks my `git(1)` workflow.

**What steps will reproduce the bug?**

```bash
# Works
$ bat big-file.txt

# Fails to page
$ cat big-file.txt | bat

# Fails to page
$ cat big-file.txt | bat -

# Works (because an actual file is specified)
$ cat big-file.txt | bat /dev/fd/0
```

**What happens?**

`bat` doesn't page - the file is just dumped to `stdout` _a la `cat(1)`_.

**What did you expect to happen instead?**

`bat` should page the file.

**How did you install `bat`?**

```bash
$ git clone https://github.com/sharkdp/bat
$ cargo install --path .
```

---

```bash
$ bat --version
bat 0.23.0 (b420c42)
```



Discussion / hints:
I'm afraid I don't have time to debug the problem but the code in this block looks odd and potentially related:

- https://github.com/sharkdp/bat/blob/master/src/bin/bat/app.rs#L311..L324

It looks like `files` being `None` is handled twice: once on line 311 and again on 318, but presumably we can't get to that line?

Fix patch:
diff --git a/src/bin/bat/app.rs b/src/bin/bat/app.rs
index f7f4c4af66..fc84e2a3f2 100644
--- a/src/bin/bat/app.rs
+++ b/src/bin/bat/app.rs
@@ -104,7 +104,7 @@ impl App {
                     // If we are reading from stdin, only enable paging if we write to an
                     // interactive terminal and if we do not *read* from an interactive
                     // terminal.
-                    if self.interactive_output && std::io::stdin().is_terminal() {
+                    if self.interactive_output && !std::io::stdin().is_terminal() {
                         PagingMode::QuitIfOneScreen
                     } else {
                         PagingMode::Never


Test patch: