gravel_provider_system/
linux.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use anyhow::Result;
use std::process::Command;

pub fn lock(command_linux: &str) -> Result<()> {
	shell_run(command_linux)
}

pub fn logout(command_linux: &str) -> Result<()> {
	shell_run(command_linux)
}

pub fn restart(command_linux: &str) -> Result<()> {
	shell_run(command_linux)
}

pub fn shutdown(command_linux: &str) -> Result<()> {
	shell_run(command_linux)
}

pub fn sleep(command_linux: &str) -> Result<()> {
	shell_run(command_linux)
}

fn shell_run(cmd: &str) -> Result<()> {
	Command::new("/usr/bin/env").arg("bash").arg("-c").arg(cmd).spawn()?;

	Ok(())
}