Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion hyperactor/src/attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ impl<'de> Visitor<'de> for AttrsVisitor {

let exe_name = std::env::current_exe()
.ok()
.and_then(|p| p.file_name().map(|os| os.to_string_lossy().to_string()))
.map(|p| p.display().to_string())
.unwrap_or_else(|| "<unknown-exe>".to_string());

let mut attrs = Attrs::new();
Expand Down Expand Up @@ -1263,8 +1263,14 @@ mod tests {
let err = bincode::deserialize::<Attrs>(&wire_bytes)
.expect_err("should error on unknown attr key");

let exe_str = std::env::current_exe()
.ok()
.map(|p| p.display().to_string())
.unwrap_or_else(|| "<unknown-exe>".to_string());
let msg = format!("{err}");

assert!(msg.contains("unknown attr key"), "got: {msg}");
assert!(msg.contains(bad_key), "got: {msg}");
assert!(msg.contains(&exe_str), "got: {msg}");
}
}