Skip to content

Commit a0aa429

Browse files
shayne-fletchermeta-codesync[bot]
authored andcommitted
attrs: use exe.display() in error msg; good enough (#1723)
Summary: Pull Request resolved: #1723 per comment https://www.internalfb.com/diff/D85913786?dst_version_fbid=1825525151667784&transaction_fbid=802048042617906, use `p.display()`. its "good enough" (and in fact arguably better). Reviewed By: mariusae Differential Revision: D85957620 fbshipit-source-id: ef2c4ed8cf97e88eac18b5f22d8110201b5e5b06
1 parent b249a03 commit a0aa429

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

hyperactor/src/attrs.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ impl<'de> Visitor<'de> for AttrsVisitor {
629629

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

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

1266+
let exe_str = std::env::current_exe()
1267+
.ok()
1268+
.map(|p| p.display().to_string())
1269+
.unwrap_or_else(|| "<unknown-exe>".to_string());
12661270
let msg = format!("{err}");
1271+
12671272
assert!(msg.contains("unknown attr key"), "got: {msg}");
12681273
assert!(msg.contains(bad_key), "got: {msg}");
1274+
assert!(msg.contains(&exe_str), "got: {msg}");
12691275
}
12701276
}

0 commit comments

Comments
 (0)