From 59705779d14d13391759a9d62d77396daa2cf706 Mon Sep 17 00:00:00 2001 From: Hatter Jiang Date: Sat, 26 Dec 2020 22:03:21 +0800 Subject: [PATCH] chore: run_command_and_wait add return status code --- Cargo.toml | 2 +- src/util_cmd.rs | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 67e67b3..244da33 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rust_util" -version = "0.6.21" +version = "0.6.22" authors = ["Hatter Jiang "] edition = "2018" description = "Hatter's Rust Util" diff --git a/src/util_cmd.rs b/src/util_cmd.rs index 2beac6a..5e14b04 100644 --- a/src/util_cmd.rs +++ b/src/util_cmd.rs @@ -1,11 +1,11 @@ -use std::{ io::{ self, Error, ErrorKind }, process::Command }; +use std::io::{self, Error, ErrorKind}; +use std::process::{Command, ExitStatus}; -pub fn run_command_and_wait(cmd: &mut Command) -> io::Result<()> { - cmd.spawn()?.wait()?; - Ok(()) +pub fn run_command_and_wait(cmd: &mut Command) -> io::Result { + cmd.spawn()?.wait() } -pub fn extract_package_and_wait(dir: &str, file_name: &str) -> io::Result<()> { +pub fn extract_package_and_wait(dir: &str, file_name: &str) -> io::Result { let mut cmd: Command; if file_name.ends_with(".zip") { cmd = Command::new("unzip");