From ac182765e2df1623e64cc3da576e79d83adb7f82 Mon Sep 17 00:00:00 2001 From: licsber Date: Sun, 8 Sep 2024 11:49:31 +0800 Subject: [PATCH] stderr is default piped when using output. --- README.md | 4 ++++ src/main.rs | 5 ++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ac09540..2bd1bd7 100644 --- a/README.md +++ b/README.md @@ -3,3 +3,7 @@ unzip all compressed file using unar. first time write rust executable program~ + +## Reference + +https://rustwiki.org/zh-CN/std/process/struct.Command.html#method.stderr diff --git a/src/main.rs b/src/main.rs index 9fc1bc4..8dd6bd6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,8 +1,8 @@ +use std::env; use std::fs; use std::io; use std::path::{Path, PathBuf}; -use std::process::{Command, Stdio}; -use std::env; +use std::process::Command; fn unar_file(path: &Path) -> io::Result<()> { println!("UNAR: {}", path.display()); @@ -11,7 +11,6 @@ fn unar_file(path: &Path) -> io::Result<()> { let output = Command::new("unar") .current_dir(parent_dir) .arg(filename) - .stderr(Stdio::piped()) .output(); match output {