stderr is default piped when using output.
This commit is contained in:
parent
00e1313980
commit
ac182765e2
@ -3,3 +3,7 @@
|
|||||||
unzip all compressed file using unar.
|
unzip all compressed file using unar.
|
||||||
|
|
||||||
first time write rust executable program~
|
first time write rust executable program~
|
||||||
|
|
||||||
|
## Reference
|
||||||
|
|
||||||
|
https://rustwiki.org/zh-CN/std/process/struct.Command.html#method.stderr
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
|
use std::env;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::process::{Command, Stdio};
|
use std::process::Command;
|
||||||
use std::env;
|
|
||||||
|
|
||||||
fn unar_file(path: &Path) -> io::Result<()> {
|
fn unar_file(path: &Path) -> io::Result<()> {
|
||||||
println!("UNAR: {}", path.display());
|
println!("UNAR: {}", path.display());
|
||||||
@ -11,7 +11,6 @@ fn unar_file(path: &Path) -> io::Result<()> {
|
|||||||
let output = Command::new("unar")
|
let output = Command::new("unar")
|
||||||
.current_dir(parent_dir)
|
.current_dir(parent_dir)
|
||||||
.arg(filename)
|
.arg(filename)
|
||||||
.stderr(Stdio::piped())
|
|
||||||
.output();
|
.output();
|
||||||
|
|
||||||
match output {
|
match output {
|
||||||
|
Loading…
Reference in New Issue
Block a user