split out valgrind reporting code

This commit is contained in:
Folkert 2022-12-30 14:54:24 +01:00
parent ecfc7b65e7
commit f54b1f577c
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
2 changed files with 76 additions and 46 deletions

View file

@ -251,10 +251,10 @@ pub fn run_with_valgrind<'a, I: IntoIterator<Item = &'a str>>(
let mut cmd = Command::new("valgrind");
let named_tempfile =
NamedTempFile::new().expect("Unable to create tempfile for valgrind results");
let filepath = named_tempfile.path().to_str().unwrap();
cmd.arg("--tool=memcheck");
cmd.arg("--xml=yes");
cmd.arg(format!("--xml-file={}", named_tempfile.path().display()));
// If you are having valgrind issues on MacOS, you may need to suppress some
// of the errors. Read more here: https://github.com/roc-lang/roc/issues/746
@ -274,8 +274,6 @@ pub fn run_with_valgrind<'a, I: IntoIterator<Item = &'a str>>(
}
}
cmd.arg(format!("--xml-file={}", filepath));
for arg in args {
cmd.arg(arg);
}