1
0
mirror of https://github.com/jht5945/rust_util.git synced 2025-12-27 07:30:05 +08:00

chore: run_command_and_wait add return status code

This commit is contained in:
2020-12-26 22:03:21 +08:00
parent 0001f67f0d
commit 59705779d1
2 changed files with 6 additions and 6 deletions

View File

@@ -1,6 +1,6 @@
[package]
name = "rust_util"
version = "0.6.21"
version = "0.6.22"
authors = ["Hatter Jiang <jht5945@gmail.com>"]
edition = "2018"
description = "Hatter's Rust Util"

View File

@@ -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<ExitStatus> {
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<ExitStatus> {
let mut cmd: Command;
if file_name.ends_with(".zip") {
cmd = Command::new("unzip");