mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-01 22:31:47 +00:00

## Summary This is similar to `commands::check` vs. `commands::check_stdin`, and gets the logic out of the parent file (`lib.rs`). It also ensures that we avoid formatting files that should be excluded when `--force-exclude` is provided.
9 lines
234 B
Rust
9 lines
234 B
Rust
use std::io;
|
|
use std::io::Read;
|
|
|
|
/// Read a string from `stdin`.
|
|
pub(crate) fn read_from_stdin() -> Result<String, io::Error> {
|
|
let mut buffer = String::new();
|
|
io::stdin().lock().read_to_string(&mut buffer)?;
|
|
Ok(buffer)
|
|
}
|