From e0f3374e56b72d972844a982df59d95aac5ba053 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Thu, 2 Apr 2026 10:12:57 -0500 Subject: [PATCH] feat(snapbox): Add Command::cargo_bin --- crates/snapbox/src/cmd.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/crates/snapbox/src/cmd.rs b/crates/snapbox/src/cmd.rs index 5591b54..caddb1a 100644 --- a/crates/snapbox/src/cmd.rs +++ b/crates/snapbox/src/cmd.rs @@ -17,6 +17,20 @@ pub struct Command { /// # Builder API impl Command { + /// Look up the path to a cargo-built binary within an integration test + /// + /// Cargo support: + /// - `>1.94`: works + /// - `>=1.91,<=1.93`: works with default `build-dir` + /// - `<=1.92`: works + /// + /// # Panic + /// + /// Panics if no binary is found + pub fn cargo_bin(name: &str) -> Self { + Self::new(cargo_bin(name)) + } + pub fn new(program: impl AsRef) -> Self { Self { cmd: std::process::Command::new(program),