Skip to content

Commit

Permalink
Use tokio to read from stdin
Browse files Browse the repository at this point in the history
  • Loading branch information
ia0 committed Jun 3, 2024
1 parent d94114a commit 7b483cb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rust/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
// limitations under the License.

use std::fmt::Write;
use std::io::Read;
use std::path::PathBuf;
use std::sync::Arc;

use anyhow::{bail, ensure, Result};
use clap::Parser;
use ort::GraphOptimizationLevel;
use tokio::fs::File;
use tokio::io::AsyncReadExt;

/// Determines the content type of files with deep-learning.
#[derive(Parser)]
Expand Down Expand Up @@ -133,7 +133,7 @@ async fn extract_features(
for (index, path) in flags.path.iter().enumerate() {
let features_or_output: magika::FeaturesOrOutput = if path.to_str() == Some("-") {
let mut stdin = Vec::new();
std::io::stdin().read_to_end(&mut stdin)?;
tokio::io::stdin().read_to_end(&mut stdin).await?;
magika::FeaturesOrOutput::extract_sync(&stdin[..])?
} else {
let mut result = None;
Expand Down

0 comments on commit 7b483cb

Please sign in to comment.