Skip to content

Commit 10231ea

Browse files
committed
Provide opt-out condition for sys_signame[].
This PR adds `SWT_NO_SYS_SIGNAME` which can be set in environments where the [`sys_signame[]`](https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/sys_signame.3.html) array is not available.
1 parent 0b47e51 commit 10231ea

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Sources/Testing/ExitTests/ExitStatus.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ extension ExitStatus: CustomStringConvertible {
121121
var signalName: String?
122122

123123
#if SWT_TARGET_OS_APPLE || os(FreeBSD) || os(OpenBSD) || os(Android)
124+
#if !SWT_NO_SYS_SIGNAME
124125
// These platforms define sys_signame with a size, which is imported
125126
// into Swift as a tuple.
126127
withUnsafeBytes(of: sys_signame) { sys_signame in
@@ -130,6 +131,7 @@ extension ExitStatus: CustomStringConvertible {
130131
}
131132
}
132133
}
134+
#endif
133135
#elseif os(Linux)
134136
#if !SWT_NO_DYNAMIC_LINKING
135137
signalName = _sigabbrev_np?(signal).flatMap(String.init(validatingCString:))

0 commit comments

Comments
 (0)