Skip to content

Commit bc66ca1

Browse files
committed
fix
1 parent 6398c0d commit bc66ca1

File tree

2 files changed

+5
-14
lines changed

2 files changed

+5
-14
lines changed

src/main.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
use std::env;
21
use std::path::Path;
2+
use std::{env, process};
33
use upt::{detect_os, detect_vendor, init_vendor, run_command, UptError, Vendor};
44

55
fn main() {
66
match run() {
77
Ok(c) => {
8-
std::process::exit(c);
8+
process::exit(c);
99
}
1010
Err(e) => {
1111
eprintln!("{}", e);
12-
std::process::exit(1);
12+
process::exit(1);
1313
}
1414
}
1515
}

src/utils.rs

+2-11
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::process::{Command, Output};
1+
use std::process::Command;
22

33
use which::which;
44

@@ -42,7 +42,7 @@ pub fn find_tool(pairs: &[(&str, &str)]) -> Option<String> {
4242
pub fn detect_os() -> Option<String> {
4343
if std::env::var("MSYSTEM").is_ok() {
4444
let os = "windows/msys2";
45-
if let Ok(output) = run_command_with_output("which pacman", os) {
45+
if let Ok(output) = Command::new("sh").arg("-c").arg("which pacman").output() {
4646
if output.status.success() {
4747
return Some(os.to_string());
4848
}
@@ -87,12 +87,3 @@ pub fn run_command(cmd: &str, os: &str) -> Result<i32, Box<dyn std::error::Error
8787
};
8888
Ok(exit_status.code().unwrap_or_default())
8989
}
90-
91-
pub fn run_command_with_output(cmd: &str, os: &str) -> Result<Output, Box<dyn std::error::Error>> {
92-
let output = if os == "windows" {
93-
Command::new("cmd").args(["/C", cmd]).output()?
94-
} else {
95-
Command::new("sh").arg("-c").arg(cmd).output()?
96-
};
97-
Ok(output)
98-
}

0 commit comments

Comments
 (0)