|
59 | 59 | #![deny(missing_docs)] |
60 | 60 |
|
61 | 61 | use std::fs::{self, File}; |
62 | | -use std::io::{self, BufRead, BufReader, ErrorKind, IsTerminal}; |
| 62 | +use std::io::{self, BufRead, BufReader, ErrorKind, IsTerminal, stdin}; |
63 | 63 | use std::path::PathBuf; |
64 | 64 |
|
65 | 65 | use anyhow::{Context, Error, Result}; |
@@ -311,11 +311,11 @@ async fn run(opts: &LycheeOptions) -> Result<i32> { |
311 | 311 | // |
312 | 312 | // When stdin is piped (`cat links.txt | lychee -`), `is_terminal()` returns |
313 | 313 | // false, so the progress bar is shown normally. |
314 | | - let stdin_input = inputs.len() == 1 |
| 314 | + let is_stdin_input = inputs.len() == 1 |
315 | 315 | && inputs |
316 | 316 | .iter() |
317 | 317 | .any(|input| matches!(input.source, lychee_lib::InputSource::Stdin)) |
318 | | - && std::io::stdin().is_terminal(); |
| 318 | + && stdin().is_terminal(); |
319 | 319 |
|
320 | 320 | // TODO: Remove this section after `--base` got removed with 1.0 |
321 | 321 | let base = match (opts.config.base.clone(), opts.config.base_url.clone()) { |
@@ -384,7 +384,7 @@ async fn run(opts: &LycheeOptions) -> Result<i32> { |
384 | 384 | cache, |
385 | 385 | requests, |
386 | 386 | cfg: opts.config.clone(), |
387 | | - stdin_input, |
| 387 | + stdin_input: is_stdin_input, |
388 | 388 | }; |
389 | 389 |
|
390 | 390 | let exit_code = if opts.config.dump { |
|
0 commit comments