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 1313#if (os(macOS) || os(Linux)) && (arch(x86_64) || arch(arm64))
1414
1515#if canImport(Darwin)
16- import Darwin. C
16+ import Darwin
1717#elseif canImport(Glibc)
1818import Glibc
1919#elseif canImport(CRT)
@@ -511,6 +511,22 @@ Generate a backtrace for the parent process.
511511 writeln ( " Backtrace took \( formattedDuration) s " )
512512 writeln ( " " )
513513
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+
514530 if args. interactive {
515531 // Make sure we're line buffered
516532 setvbuf ( stdout, nil , _IOLBF, 0 )
You can’t perform that action at this time.
0 commit comments