This repository was archived by the owner on Aug 16, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +17
-3
lines changed Expand file tree Collapse file tree 3 files changed +17
-3
lines changed Original file line number Diff line number Diff line change 11extern crate version_check;
22
3+ use std:: env;
34use version_check:: is_min_version;
45
56fn main ( ) {
@@ -8,4 +9,9 @@ fn main() {
89 if is_min_version ( "1.30" ) . unwrap_or ( false ) {
910 println ! ( "cargo:rustc-cfg=has_error_source" ) ;
1011 }
12+
13+ // So we can get the build profile for has_backtrace_depending_on_env test
14+ if let Ok ( profile) = env:: var ( "PROFILE" ) {
15+ println ! ( "cargo:rustc-cfg=build={:?}" , profile) ;
16+ }
1117}
File renamed without changes.
Original file line number Diff line number Diff line change @@ -199,13 +199,21 @@ fn empty() {
199199#[ test]
200200#[ cfg( feature = "backtrace" ) ]
201201fn has_backtrace_depending_on_env ( ) {
202- use std:: path:: Path ;
202+ use std:: path:: PathBuf ;
203203 use std:: process:: Command ;
204204
205+ let cmd_folder = if cfg ! ( build="debug" ) {
206+ "debug"
207+ } else if cfg ! ( build="release" ) {
208+ "release"
209+ } else {
210+ panic ! ( "Unknown build config" ) ;
211+ } ;
212+
205213 let cmd_path = if cfg ! ( windows) {
206- Path :: new ( "./target/debug/ has_backtrace.exe" )
214+ PathBuf :: from ( format ! ( "./target/{}/examples/ has_backtrace.exe" , cmd_folder ) )
207215 } else {
208- Path :: new ( "./target/debug/ has_backtrace" )
216+ PathBuf :: from ( format ! ( "./target/{}/examples/ has_backtrace" , cmd_folder ) )
209217 } ;
210218 let mut cmd = Command :: new ( cmd_path) ;
211219
You can’t perform that action at this time.
0 commit comments