This repository was archived by the owner on Aug 16, 2021. It is now read-only.
File tree 3 files changed +17
-3
lines changed
3 files changed +17
-3
lines changed Original file line number Diff line number Diff line change 1
1
extern crate version_check;
2
2
3
+ use std:: env;
3
4
use version_check:: is_min_version;
4
5
5
6
fn main ( ) {
@@ -8,4 +9,9 @@ fn main() {
8
9
if is_min_version ( "1.30" ) . unwrap_or ( false ) {
9
10
println ! ( "cargo:rustc-cfg=has_error_source" ) ;
10
11
}
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
+ }
11
17
}
File renamed without changes.
Original file line number Diff line number Diff line change @@ -199,13 +199,21 @@ fn empty() {
199
199
#[ test]
200
200
#[ cfg( feature = "backtrace" ) ]
201
201
fn has_backtrace_depending_on_env ( ) {
202
- use std:: path:: Path ;
202
+ use std:: path:: PathBuf ;
203
203
use std:: process:: Command ;
204
204
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
+
205
213
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 ) )
207
215
} else {
208
- Path :: new ( "./target/debug/ has_backtrace" )
216
+ PathBuf :: from ( format ! ( "./target/{}/examples/ has_backtrace" , cmd_folder ) )
209
217
} ;
210
218
let mut cmd = Command :: new ( cmd_path) ;
211
219
You can’t perform that action at this time.
0 commit comments