Skip to content

Commit 9a7a4bd

Browse files
committed
fixup: try to chown before writing
1 parent e08063a commit 9a7a4bd

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

  • src/run/runner/wall_time/perf

src/run/runner/wall_time/perf/mod.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,19 @@ impl PerfRunner {
156156
// Get the perf data file path from the stored tempfile
157157
let perf_data_file_path = self.perf_file.path();
158158

159+
// Ensure we have the permissions to write to the tempfile when running with sudo
160+
run_with_sudo(
161+
"chown",
162+
[
163+
&format!(
164+
"{}:{}",
165+
nix::unistd::Uid::current(),
166+
nix::unistd::Gid::current()
167+
),
168+
&perf_data_file_path.to_string_lossy().to_string(),
169+
],
170+
)?;
171+
159172
let raw_command = format!(
160173
"set -o pipefail && {} | cat > {}",
161174
&cmd_builder.as_command_line(),

0 commit comments

Comments
 (0)