Skip to content

Commit

Permalink
fix: stop using STDIN
Browse files Browse the repository at this point in the history
  • Loading branch information
delehef committed Aug 30, 2023
1 parent 3f1f7fd commit 7c24ac0
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -421,8 +421,6 @@ impl ConstraintSetBuilder {

#[cfg(feature = "cli")]
fn main() -> Result<()> {
use std::io::{self, Read};

let args = Args::parse();
buche::new()
.verbosity(args.verbose.log_level_filter())
Expand All @@ -436,15 +434,12 @@ fn main() -> Result<()> {
.unwrap();

let mut builder = if cfg!(feature = "parser") {
if !atty::is(atty::Stream::Stdin) {
let mut r = ConstraintSetBuilder::from_sources(args.no_stdlib, args.debug);
let mut input = String::new();
io::stdin().read_to_string(&mut input)?;
r.add_source(&input)?;
r
} else if matches!(args.command, Commands::Format { .. }) {
if matches!(args.command, Commands::Format { .. }) {
if args.source.len() != 1 {
bail!("can only format one file at a time")
bail!(
"can only format one file at a time; found {}",
args.source.len()
)
} else if args.source.len() == 1
&& Path::new(&args.source[0])
.extension()
Expand Down

0 comments on commit 7c24ac0

Please sign in to comment.