-
Notifications
You must be signed in to change notification settings - Fork 61
/
Copy pathattempt.rs
37 lines (31 loc) · 902 Bytes
/
attempt.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
use std::process::{Command, Stdio};
use crate::template::Day;
pub fn handle(day: Day, test: Option<String>, dhat: bool) {
let year = crate::template::get_year_exit_on_fail();
let year = format!("advent_of_code_{}", year);
let mut cmd_args = vec![
"test".to_string(),
"-p".to_string(),
year,
"--bin".to_string(),
day.to_string(),
];
if dhat {
cmd_args.extend([
"--profile".to_string(),
"dhat".to_string(),
"--features".to_string(),
"dhat-heap".to_string(),
]);
} else if let Some(test_id) = test {
cmd_args.push(test_id);
}
cmd_args.push("--".to_string());
let mut cmd = Command::new("cargo")
.args(&cmd_args)
.stdout(Stdio::inherit())
.stderr(Stdio::inherit())
.spawn()
.unwrap();
cmd.wait().unwrap();
}