gravel_provider_system/
linux.rs1use anyhow::Result;
2use std::process::Command;
3
4pub fn lock(command_linux: &str) -> Result<()> {
5 shell_run(command_linux)
6}
7
8pub fn logout(command_linux: &str) -> Result<()> {
9 shell_run(command_linux)
10}
11
12pub fn restart(command_linux: &str) -> Result<()> {
13 shell_run(command_linux)
14}
15
16pub fn shutdown(command_linux: &str) -> Result<()> {
17 shell_run(command_linux)
18}
19
20pub fn sleep(command_linux: &str) -> Result<()> {
21 shell_run(command_linux)
22}
23
24fn shell_run(cmd: &str) -> Result<()> {
25 Command::new("/usr/bin/env").arg("bash").arg("-c").arg(cmd).spawn()?;
26
27 Ok(())
28}