From 578d17764c7d26675d4409b705477ae9e98cdb5c Mon Sep 17 00:00:00 2001 From: KingRainbow44 Date: Fri, 1 Jul 2022 16:25:52 -0400 Subject: [PATCH] Change logic for command invoking --- src-tauri/src/system_helpers.rs | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src-tauri/src/system_helpers.rs b/src-tauri/src/system_helpers.rs index 56f7843..10b68e0 100644 --- a/src-tauri/src/system_helpers.rs +++ b/src-tauri/src/system_helpers.rs @@ -1,8 +1,8 @@ use std::thread; -use std::process::Command; use tauri; use open; +use duct::cmd; use crate::file_helpers; @@ -19,18 +19,8 @@ pub fn run_program(path: String) { #[tauri::command] pub fn run_command(command: String) { // Run the specified command. - if cfg!(target_os = "windows") { - Command::new("cmd") - .args(["/C", command.as_str()]) - .output() - .expect("failed to execute process") - } else { - Command::new("sh") - .arg("-c") - .arg(command.as_str()) - .output() - .expect("failed to execute process") - }; + cmd!(command).run() + .expect("Failed to run command"); } #[tauri::command]