Skip to content

Commit 162996e

Browse files
committed
chore: relative stdin path to absolute
1 parent a47b332 commit 162996e

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

crates/exec-harness/src/lib.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ pub fn read_commands_from_stdin() -> Result<Vec<BenchmarkCommand>> {
5454
input.push('\n');
5555
}
5656

57-
let commands: Vec<BenchmarkCommand> =
57+
let mut commands: Vec<BenchmarkCommand> =
5858
serde_json::from_str(&input).context("Failed to parse JSON from stdin")?;
5959

6060
if commands.is_empty() {
@@ -67,6 +67,17 @@ pub fn read_commands_from_stdin() -> Result<Vec<BenchmarkCommand>> {
6767
}
6868
}
6969

70+
for cmd in &mut commands {
71+
if let Some(stdin_path) = &cmd.stdin {
72+
if !stdin_path.is_absolute() {
73+
cmd.stdin = Some(
74+
std::fs::canonicalize(stdin_path)
75+
.unwrap_or_else(|_| std::env::current_dir().unwrap().join(stdin_path)),
76+
);
77+
}
78+
}
79+
}
80+
7081
Ok(commands)
7182
}
7283

0 commit comments

Comments
 (0)