Write to a root-owned /proc or /sys node. `run_with_sudo` cannot pipe stdin, so the redirect happens inside a shell instead of `sudo tee`.
(path: &str, value: &str)
| 253 | /// Write to a root-owned /proc or /sys node. `run_with_sudo` cannot pipe stdin, |
| 254 | /// so the redirect happens inside a shell instead of `sudo tee`. |
| 255 | fn write_root_file(path: &str, value: &str) -> Result<()> { |
| 256 | run_with_sudo("sh", ["-c", &format!("printf '%s' {value} > {path}")]) |
| 257 | } |
| 258 | |
| 259 | #[cfg(test)] |
| 260 | mod tests { |
no test coverage detected