mirror of
https://gitlab.com/gabmus/envision.git
synced 2025-04-20 11:35:48 +00:00
feat: function to set CAP_SYS_NICE
This commit is contained in:
parent
d9b0412aca
commit
e81ca83f9e
1 changed files with 11 additions and 1 deletions
|
@ -7,7 +7,7 @@ use std::{
|
|||
|
||||
use expect_dialog::ExpectDialog;
|
||||
|
||||
use crate::constants::CMD_NAME;
|
||||
use crate::{constants::CMD_NAME, runner::Runner};
|
||||
|
||||
pub fn get_writer(path_s: &String) -> BufWriter<std::fs::File> {
|
||||
let path = Path::new(path_s);
|
||||
|
@ -72,3 +72,13 @@ pub fn set_file_radonly(path_s: &String, readonly: bool) {
|
|||
perms.set_readonly(readonly);
|
||||
fs::set_permissions(path, perms).expect_dialog("Could not set permissions for file")
|
||||
}
|
||||
|
||||
pub fn setcap_cap_sys_nice_eip(file: String) {
|
||||
let mut runner = Runner::new(None, "pkexec".into(), vec![
|
||||
"setcap".into(),
|
||||
"CAP_SYS_NICE=eip".into(),
|
||||
file
|
||||
]);
|
||||
runner.start();
|
||||
runner.join();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue