Skip to content

Commit 6ff8bef

Browse files
committed
Alas, Linux
1 parent aa1083f commit 6ff8bef

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

Sources/Testing/ExitTests/ExitCondition.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ public enum ExitCondition: Sendable {
4444
/// | Linux | `<stdlib.h>`, `<sysexits.h>` |
4545
/// | Windows | [`<stdlib.h>`](https://learn.microsoft.com/en-us/cpp/c-runtime-library/exit-success-exit-failure) |
4646
///
47-
/// On macOS, Linux, and Windows, the full exit code reported by the process
48-
/// is yielded to the parent process. Other POSIX-like systems may only
47+
/// On macOS and Windows, the full exit code reported by the process is
48+
/// yielded to the parent process. Linux and other POSIX-like systems may only
4949
/// reliably report the low unsigned 8 bits (0&ndash;255) of the exit code.
5050
case exitCode(_ exitCode: CInt)
5151

Tests/TestingTests/ExitTestTests.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,20 +198,23 @@ private import _TestingInternals
198198
}
199199
}
200200

201+
#if !os(Linux)
201202
@Test("Exit test reports > 8 bits of the exit code")
202203
func fullWidthExitCode() async {
203204
// On macOS and Linux, we use waitid() which per POSIX should report the
204205
// full exit code, not just the low 8 bits. This behaviour is not
205-
// well-documented and other POSIX-like implementations may not follow it,
206-
// so this test serves as a canary when adding new platforms that we need
207-
// to document the difference.
206+
// well-documented and while Darwin correctly reports the full value, Linux
207+
// does not (at least as of this writing) and other POSIX-like systems may
208+
// also have issues. This test serves as a canary when adding new platforms
209+
// that we need to document the difference.
208210
//
209211
// Windows does not have the 8-bit exit code restriction and always reports
210212
// the full CInt value back to the testing library.
211213
await #expect(exitsWith: .exitCode(512)) {
212214
exit(512)
213215
}
214216
}
217+
#endif
215218
}
216219

217220
// MARK: - Fixtures

0 commit comments

Comments
 (0)