Skip to content

Commit aa5a0d8

Browse files
committed
use temp_dir
1 parent 2989dff commit aa5a0d8

File tree

1 file changed

+3
-3
lines changed
  • crates/forge/bin/cmd/test

1 file changed

+3
-3
lines changed

crates/forge/bin/cmd/test/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -420,13 +420,13 @@ impl TestArgs {
420420
let svg_data = String::from_utf8(data)?;
421421
let svg_data = svg_data.replace("samples", "gas");
422422

423-
// Write to temp file and open it in default program.
423+
// Write file to temporary location and open it in default program.
424424
let file_name = format!(
425-
"tmp/flamegraph_{contract}_{test_name}.svg",
425+
"{tmp_dir}/flamegraph_{contract}_{test_name}.svg",
426+
tmp_dir = std::env::temp_dir().display(),
426427
contract = suite_name.split(':').last().unwrap(),
427428
test_name = test_name.trim_end_matches("()")
428429
);
429-
let _ = std::fs::create_dir("tmp");
430430
let mut file = std::fs::File::create(&file_name).wrap_err("failed to create file")?;
431431
file.write_all(svg_data.as_bytes()).wrap_err("failed to save flamegraph")?;
432432
opener::open(&file_name).wrap_err("failed to open flamergpah")?;

0 commit comments

Comments
 (0)