1#![feature(is_sorted)]
2pub mod args;
3pub mod config;
4pub mod repolist;
5
6pub use config::*;
7pub mod tui;
8
9use std::process::{Command, ExitStatus};
10
11pub fn execute(
12 command_to_launch: String,
13 current_dir: Option<&str>,
14) -> Result<ExitStatus, std::io::Error> {
15 println!("{}", command_to_launch);
16 let mut execute_command;
17 if cfg!(target_os = "windows") {
18 execute_command = Command::new("cmd");
19 execute_command.args(["/C", &command_to_launch]);
20 } else {
21 execute_command = Command::new("sh");
22 execute_command.args(["-c", &command_to_launch]);
23 };
24 if let Some(dir) = current_dir {
25 execute_command.current_dir(dir);
26 }
27 let spawn = execute_command.spawn()?.wait()?;
28 Ok(spawn)
29}