From 9c6fb14227f55d8f711ce3847dc2f419fb0ecacb Mon Sep 17 00:00:00 2001 From: Honza Dvorsky Date: Tue, 8 Sep 2026 12:02:37 +0200 Subject: [PATCH] Fix referencing WASILibc.stdout/stderr in Swift 6.5+ (#507) ### Motivation: Nightly CI on nightly-main toolchains started failing on August 11, when we started downloading swift-DEVELOPMENT-SNAPSHOT-2026-08-08 instead of swift-DEVELOPMENT-SNAPSHOT-2026-07-11. Appears to be fallout from https://github.com/swiftlang/swift/commit/73fee3394d3102847fef26c1bdea49a67061f043 improving the optionality and concurrency of stdout/stderr/stdin on the various platforms. ### Modifications: Adapted Swift Log code to handle both the existing and behavior, guarded by a `compiler(>=6.5)` Also enabled nightly-next, which tracks the pre-release 6.4 right now, but hasn't received this change. ### Result: Passing CI, hopefully :) --- Sources/Logging/Handlers/StreamLogHandler.swift | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Sources/Logging/Handlers/StreamLogHandler.swift b/Sources/Logging/Handlers/StreamLogHandler.swift index 16610ac..31a4e6d 100644 --- a/Sources/Logging/Handlers/StreamLogHandler.swift +++ b/Sources/Logging/Handlers/StreamLogHandler.swift @@ -345,8 +345,13 @@ internal struct StdioOutputStream: TextOutputStream, @unchecked Sendable { ) #elseif canImport(WASILibc) // no file locking on WASI + #if compiler(>=6.5) + let file = WASILibc.stderr + #else + let file = WASILibc.stderr! + #endif return StdioOutputStream( - file: WASILibc.stderr!, + file: file, flushMode: .always, lock: nil, unlock: nil, @@ -417,8 +422,13 @@ internal struct StdioOutputStream: TextOutputStream, @unchecked Sendable { ) #elseif canImport(WASILibc) // no file locking on WASI + #if compiler(>=6.5) + let file = WASILibc.stdout + #else + let file = WASILibc.stdout! + #endif return StdioOutputStream( - file: WASILibc.stdout!, + file: file, flushMode: .always, lock: nil, unlock: nil,