@@ -584,7 +584,8 @@ pub fn try_build(attributes: Attributes) -> Result<()> {
584584
585585 println ! ( "cargo:rustc-env=TAURI_ENV_TARGET_TRIPLE={target_triple}" ) ;
586586 // when running codegen in this build script, we need to access the env var directly
587- env:: set_var ( "TAURI_ENV_TARGET_TRIPLE" , & target_triple) ;
587+ // FIXME: This can be accessed from multiple threads
588+ unsafe { env:: set_var ( "TAURI_ENV_TARGET_TRIPLE" , & target_triple) } ;
588589
589590 let target_dir = target_dir_from_out_dir ( & out_dir)
590591 . with_context ( || format ! ( "failed to resolve the target directory from {out_dir:?}" ) ) ?;
@@ -873,18 +874,18 @@ mod tests {
873874 assert ! ( crate :: should_static_link_vc_runtime( & config, & attributes) ) ;
874875
875876 // 2. Set to anything but "false" in env, should be true
876- std:: env:: set_var ( "STATIC_VCRUNTIME" , "qweqe" ) ;
877+ unsafe { std:: env:: set_var ( "STATIC_VCRUNTIME" , "qweqe" ) } ;
877878 let config = tauri_utils:: config:: Config :: default ( ) ;
878879 let attributes = crate :: Attributes :: new ( ) ;
879880 assert ! ( crate :: should_static_link_vc_runtime( & config, & attributes) ) ;
880- std:: env:: remove_var ( "STATIC_VCRUNTIME" ) ;
881+ unsafe { std:: env:: remove_var ( "STATIC_VCRUNTIME" ) } ;
881882
882883 // 3. Set to "false" in env, should be false
883- std:: env:: set_var ( "STATIC_VCRUNTIME" , "false" ) ;
884+ unsafe { std:: env:: set_var ( "STATIC_VCRUNTIME" , "false" ) } ;
884885 let config = tauri_utils:: config:: Config :: default ( ) ;
885886 let attributes = crate :: Attributes :: new ( ) ;
886887 assert ! ( !crate :: should_static_link_vc_runtime( & config, & attributes) ) ;
887- std:: env:: remove_var ( "STATIC_VCRUNTIME" ) ;
888+ unsafe { std:: env:: remove_var ( "STATIC_VCRUNTIME" ) } ;
888889
889890 // 4. Set to true in attributes, should be true
890891 let config = tauri_utils:: config:: Config :: default ( ) ;
@@ -939,11 +940,11 @@ mod tests {
939940 assert ! ( !crate :: should_static_link_vc_runtime( & config, & attributes) ) ;
940941
941942 // 9. Set to false in env and true in attributes, should be false because env takes precedence over attributes
942- std:: env:: set_var ( "STATIC_VCRUNTIME" , "false" ) ;
943+ unsafe { std:: env:: set_var ( "STATIC_VCRUNTIME" , "false" ) } ;
943944 let config = tauri_utils:: config:: Config :: default ( ) ;
944945 let attributes = crate :: Attributes :: new ( )
945946 . windows_attributes ( crate :: WindowsAttributes :: new ( ) . static_vc_runtime ( true ) ) ;
946947 assert ! ( !crate :: should_static_link_vc_runtime( & config, & attributes) ) ;
947- std:: env:: remove_var ( "STATIC_VCRUNTIME" ) ;
948+ unsafe { std:: env:: remove_var ( "STATIC_VCRUNTIME" ) } ;
948949 }
949950}
0 commit comments