(path: &Path, owner_spec: &str, recursive: bool)
| 334 | } |
| 335 | |
| 336 | fn chown_path(path: &Path, owner_spec: &str, recursive: bool) -> Result<(), Box<dyn Error>> { |
| 337 | let mut command = std::process::Command::new("chown"); |
| 338 | if recursive { |
| 339 | command.arg("-R"); |
| 340 | } |
| 341 | let path_arg = path.to_string_lossy().into_owned(); |
| 342 | command.args([owner_spec, path_arg.as_str()]); |
| 343 | let output = command.output()?; |
| 344 | if output.status.success() { |
| 345 | return Ok(()); |
| 346 | } |
| 347 | |
| 348 | Err(format!( |
| 349 | "chown failed for '{}' with owner '{}': status={}, stderr={}", |
| 350 | path.display(), |
| 351 | owner_spec, |
| 352 | output.status, |
| 353 | String::from_utf8_lossy(&output.stderr).trim() |
| 354 | ) |
| 355 | .into()) |
| 356 | } |
| 357 | |
| 358 | fn align_owner_with_openclaw_path( |
| 359 | path: &Path, |
no test coverage detected