diff --git a/src/main.rs b/src/main.rs index 9e6f843..09072d2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -384,16 +384,20 @@ fn cargo_careful(args: env::Args) -> Result<()> { // Enable Main Thread Checker on Apple platforms, as documented here: // + // + // `DYLD_INSERT_LIBRARIES` is not inherited by child processes, so we need + // to tell Cargo to set this environment variable for the processes it + // launches (instead of just setting it using `cmd.env`). + // + // FIXME: We only do this if the host is running on macOS, since cargo + // doesn't currently have a good way of passing environment variables to + // only target binaries (the `env` config makes `rustc` also run under the + // main thread checker, which will probably fail on other platforms). + // See .\ let apple_target = target.contains("-darwin") || target.contains("-ios") || target.contains("-tvos") || target.contains("-watchos"); - // FIXME: We only do this if the host is running on macOS, since cargo - // doesn't currently have a good way of passing environment variables only - // to target binaries when using `cargo run` or `cargo test` (and this - // means that `rustc` is also run under the main thread checker, which will - // probably fail on other platforms). - // See . if apple_target && cfg!(target_os = "macos") { if let Some(path) = main_thread_checker_path()? { cmd.arg("--config");