fix: try to fix service not started on linux

This commit is contained in:
huzibaca
2024-10-18 07:08:34 +08:00
parent 18139c7114
commit 770f031b8b
2 changed files with 2 additions and 19 deletions

View File

@@ -89,20 +89,18 @@ pub async fn reinstall_service() -> Result<()> {
let install_shell: String = install_path.to_string_lossy().replace(" ", "\\ ");
let uninstall_shell: String = uninstall_path.to_string_lossy().replace(" ", "\\ ");
let elevator = crate::utils::help::linux_elevator();
let _ = match get_effective_uid() {
0 => StdCommand::new(uninstall_path).status()?,
_ => StdCommand::new(elevator)
_ => StdCommand::new("sudo")
.arg("sh")
.arg("-c")
.arg(uninstall_shell)
.status()?,
};
let elevator = crate::utils::help::linux_elevator();
let status = match get_effective_uid() {
0 => StdCommand::new(install_shell).status()?,
_ => StdCommand::new(elevator)
_ => StdCommand::new("sudo")
.arg("sh")
.arg("-c")
.arg(install_shell)