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:
@@ -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"
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user