MCPcopy Create free account
hub / github.com/CodSpeedHQ/codspeed / write_root_file

Function write_root_file

src/executor/memory/tunables.rs:255–257  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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`.
255fn write_root_file(path: &str, value: &str) -> Result<()> {
256 run_with_sudo("sh", ["-c", &format!("printf '%s' {value} > {path}")])
257}
258
259#[cfg(test)]
260mod tests {

Callers 3

drop_page_cacheMethod · 0.85
set_thp_enabledMethod · 0.85
dropMethod · 0.85

Calls 1

run_with_sudoFunction · 0.85

Tested by

no test coverage detected