File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -63,6 +63,8 @@ use std::process;
6363
6464#[ doc( inline) ]
6565pub use crate :: cargo_bin;
66+ #[ doc( inline) ]
67+ pub use crate :: cargo_bin_cmd;
6668
6769/// Create a [`Command`] for a `bin` in the Cargo project.
6870///
Original file line number Diff line number Diff line change @@ -62,3 +62,33 @@ macro_rules! cargo_bin {
6262 :: std:: path:: Path :: new( env!( concat!( "CARGO_BIN_EXE_" , $bin_target_name) ) )
6363 } ;
6464}
65+
66+ /// The absolute path to a binary target's executable.
67+ ///
68+ /// The `bin_target_name` is the name of the binary
69+ /// target, exactly as-is.
70+ ///
71+ /// **NOTE:** This is only set when building an integration test or benchmark.
72+ ///
73+ /// ## Example
74+ ///
75+ /// ```rust,ignore
76+ /// use assert_cmd::prelude::*;
77+ /// use assert_cmd::cargo::cargo_bin_cmd;
78+ ///
79+ /// use std::process::Command;
80+ ///
81+ /// let mut cmd = cargo_bin_cmd!()
82+ /// .unwrap();
83+ /// let output = cmd.unwrap();
84+ /// ```
85+ #[ macro_export]
86+ #[ doc( hidden) ]
87+ macro_rules! cargo_bin_cmd {
88+ ( ) => {
89+ $crate:: cargo:: cargo_bin_cmd!( $crate:: pkg_name!( ) )
90+ } ;
91+ ( $bin_target_name: expr) => {
92+ $crate:: Command :: new( $crate:: cargo:: cargo_bin!( $bin_target_name) )
93+ } ;
94+ }
You can’t perform that action at this time.
0 commit comments