Skip to content

Commit

Permalink
fix clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
MalpenZibo committed Dec 13, 2024
1 parent 1a5b5b3 commit c788c14
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions src/utils/launcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,55 @@ use std::process::Command;

pub fn execute_command(command: String) {
tokio::spawn(async move {
Command::new("bash")
let _ = Command::new("bash")
.arg("-c")
.arg(&command)
.spawn()
.unwrap_or_else(|_| panic!("Failed to execute command {}", &command));
.unwrap_or_else(|_| panic!("Failed to execute command {}", &command))
.wait();
});
}

pub fn suspend() {
tokio::spawn(async move {
Command::new("bash")
let _ = Command::new("bash")
.arg("-c")
.arg("systemctl suspend")
.spawn()
.expect("Failed to execute command.");
.expect("Failed to execute command.")
.wait();
});
}

pub fn shutdown() {
tokio::spawn(async move {
Command::new("bash")
let _ = Command::new("bash")
.arg("-c")
.arg("shutdown now")
.spawn()
.expect("Failed to execute command.");
.expect("Failed to execute command.")
.wait();
});
}

pub fn reboot() {
tokio::spawn(async move {
Command::new("bash")
let _ = Command::new("bash")
.arg("-c")
.arg("systemctl reboot")
.spawn()
.expect("Failed to execute command.");
.expect("Failed to execute command.")
.wait();
});
}

pub fn logout() {
tokio::spawn(async move {
Command::new("bash")
let _ = Command::new("bash")
.arg("-c")
.arg("loginctl kill-user $(whoami)")
.spawn()
.expect("Failed to execute command.");
.expect("Failed to execute command.")
.wait();
});
}

0 comments on commit c788c14

Please sign in to comment.