File tree 1 file changed +17
-12
lines changed
1 file changed +17
-12
lines changed Original file line number Diff line number Diff line change @@ -235,22 +235,27 @@ fn which_freebsd() -> Option<i32> {
235
235
}
236
236
237
237
fn emcc_version_code ( ) -> Option < u64 > {
238
- let output = if cfg ! ( target_os = "windows" ) {
239
- std:: process:: Command :: new ( "emcc.bat" )
240
- . arg ( "-dumpversion" )
241
- . output ( )
242
- . ok ( )
238
+ let emcc = if cfg ! ( target_os = "windows" ) {
239
+ "emcc.bat"
243
240
} else {
244
- std:: process:: Command :: new ( "emcc" )
245
- . arg ( "-dumpversion" )
246
- . output ( )
247
- . ok ( )
248
- } ?;
241
+ "emcc"
242
+ } ;
249
243
250
- if !output. status . success ( ) {
251
- return None ;
244
+ let output = Command :: new ( emcc) . arg ( "-dumpversion" ) . output ( ) . ok ( ) ;
245
+
246
+ // If we're targeting emscripten, we need to make sure the executable is checked for the right version
247
+ let is_targeting_emscripten =
248
+ env:: var ( "CARGO_CFG_TARGET_OS" ) . map_or ( false , |os| os == "emscripten" ) ;
249
+ if output. is_none ( ) {
250
+ if is_targeting_emscripten {
251
+ panic ! ( "Failed to query emcc for version, make sure emcc is installed" ) ;
252
+ } else {
253
+ return None ;
254
+ }
252
255
}
253
256
257
+ let output = output. unwrap ( ) ;
258
+
254
259
let version = String :: from_utf8 ( output. stdout ) . ok ( ) ?;
255
260
256
261
// Some Emscripten versions come with `-git` attached, so split the
You can’t perform that action at this time.
0 commit comments