mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-12-14 08:04:52 +01:00
Change logic for command invoking
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
use std::thread;
|
use std::thread;
|
||||||
use std::process::Command;
|
|
||||||
use tauri;
|
use tauri;
|
||||||
use open;
|
use open;
|
||||||
|
use duct::cmd;
|
||||||
|
|
||||||
use crate::file_helpers;
|
use crate::file_helpers;
|
||||||
|
|
||||||
@@ -19,18 +19,8 @@ pub fn run_program(path: String) {
|
|||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
pub fn run_command(command: String) {
|
pub fn run_command(command: String) {
|
||||||
// Run the specified command.
|
// Run the specified command.
|
||||||
if cfg!(target_os = "windows") {
|
cmd!(command).run()
|
||||||
Command::new("cmd")
|
.expect("Failed to run command");
|
||||||
.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")
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
|
|||||||
Reference in New Issue
Block a user