File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
stdlib/public/libexec/swift-backtrace Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change 13
13
#if (os(macOS) || os(Linux)) && (arch(x86_64) || arch(arm64))
14
14
15
15
#if canImport(Darwin)
16
- import Darwin. C
16
+ import Darwin
17
17
#elseif canImport(Glibc)
18
18
import Glibc
19
19
#elseif canImport(CRT)
@@ -511,6 +511,22 @@ Generate a backtrace for the parent process.
511
511
writeln ( " Backtrace took \( formattedDuration) s " )
512
512
writeln ( " " )
513
513
514
+ #if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
515
+ // On Darwin, if Developer Mode is turned off, or we can't tell if it's
516
+ // on or not, disable interactivity
517
+ var developerMode : Int32 = 0
518
+ var developerModeSize : Int = MemoryLayout< Int32> . size
519
+ if args. interactive
520
+ && ( sysctlbyname ( " security.mac.amfi.developer_mode_status " ,
521
+ & developerMode,
522
+ & developerModeSize,
523
+ nil ,
524
+ 0 ) == - 1
525
+ || developerMode == 0 ) {
526
+ args. interactive = false
527
+ }
528
+ #endif
529
+
514
530
if args. interactive {
515
531
// Make sure we're line buffered
516
532
setvbuf ( stdout, nil , _IOLBF, 0 )
You can’t perform that action at this time.
0 commit comments