fix: escape path space

This commit is contained in:
GyDi 2023-03-17 08:36:19 +08:00
parent 9c4a46bcdb
commit fc5ca965ba
No known key found for this signature in database
GPG Key ID: 9C3AD40F1F99880A

View File

@ -25,6 +25,7 @@ pub fn grant_permission(core: String) -> anyhow::Result<()> {
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
let output = { let output = {
let path = path.replace(' ', "\\ "); // 避免路径中有空格
let shell = format!("setcap cap_net_bind_service,cap_net_admin=+ep {path}"); let shell = format!("setcap cap_net_bind_service,cap_net_admin=+ep {path}");
Command::new("sudo") Command::new("sudo")
.arg("sh") .arg("sh")