@@ -565,26 +565,18 @@ fn _link_or_copy(src: &Path, dst: &Path) -> Result<()> {
565
565
src
566
566
} ;
567
567
symlink ( src, dst)
568
- } else if env:: var_os ( "__CARGO_COPY_DONT_LINK_DO_NOT_USE_THIS" ) . is_some ( ) {
569
- // This is a work-around for a bug in macOS 10.15. When running on
570
- // APFS, there seems to be a strange race condition with
571
- // Gatekeeper where it will forcefully kill a process launched via
572
- // `cargo run` with SIGKILL. Copying seems to avoid the problem.
573
- // This shouldn't affect anyone except Cargo's test suite because
574
- // it is very rare, and only seems to happen under heavy load and
575
- // rapidly creating lots of executables and running them.
576
- // See https://github.com/rust-lang/cargo/issues/7821 for the
577
- // gory details.
578
- fs:: copy ( src, dst) . map ( |_| ( ) )
579
568
} else {
580
569
if cfg ! ( target_os = "macos" ) {
581
- // This is a work-around for a bug on macos. There seems to be a race condition
582
- // with APFS when hard-linking binaries. Gatekeeper does not have signing or
583
- // hash information stored in kernel when running the process. Therefore killing it.
584
- // This problem does not appear when copying files as kernel has time to process it.
585
- // Note that: fs::copy on macos is using CopyOnWrite (syscall fclonefileat) which should be
586
- // as fast as hardlinking.
587
- // See https://github.com/rust-lang/cargo/issues/10060 for the details
570
+ // There seems to be a race condition with APFS when hard-linking
571
+ // binaries. Gatekeeper does not have signing or hash information
572
+ // stored in kernel when running the process. Therefore killing it.
573
+ // This problem does not appear when copying files as kernel has
574
+ // time to process it. Note that: fs::copy on macos is using
575
+ // CopyOnWrite (syscall fclonefileat) which should be as fast as
576
+ // hardlinking. See these issues for the details:
577
+ //
578
+ // * https://github.com/rust-lang/cargo/issues/7821
579
+ // * https://github.com/rust-lang/cargo/issues/10060
588
580
fs:: copy ( src, dst) . map_or_else (
589
581
|e| {
590
582
if e. raw_os_error ( )
0 commit comments