From ef84566bb31fff94fab63161c8ec0b896fd6c769 Mon Sep 17 00:00:00 2001 From: Leo Dion Date: Fri, 28 Aug 2026 13:36:11 -0400 Subject: [PATCH] Fix Linux build: replace fputs(_:stderr) with FileHandle.standardError MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit glibc declares `stderr` as `extern FILE *stderr` — a mutable global — so Swift 6 strict concurrency rejects any reference to it: MistDemo.swift:44:33: error: reference to var 'stderr' is not concurrency-safe because it involves shared mutable state Darwin's `stderr` is imported differently, so this only breaks the "Test MistDemo on Ubuntu" job in the Examples workflow; the macOS build is unaffected. The call was introduced in #429 (0b6bea9). Switch to `FileHandle.standardError.write(Data(...utf8))`, the idiom already used across MistDemoKit (LookupCommand, ModifyCommand, ModifyZonesCommand, MistDemoConfig+DatabaseConfiguration, …) and BushelCloudKit's ConsoleOutput. `internal import Foundation` was already present. No other file under Examples/ or Sources/ references `stderr` or `stdout` in code (remaining hits are doc comments and a test string). Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01Xs1c8vvxjCxqZiStcmuPS2 --- Examples/MistDemo/Sources/MistDemo/MistDemo.swift | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Examples/MistDemo/Sources/MistDemo/MistDemo.swift b/Examples/MistDemo/Sources/MistDemo/MistDemo.swift index 025be57f..d8ce7377 100644 --- a/Examples/MistDemo/Sources/MistDemo/MistDemo.swift +++ b/Examples/MistDemo/Sources/MistDemo/MistDemo.swift @@ -39,9 +39,12 @@ internal enum MistDemo { } catch { // PhasedIntegrationTest prints a copy-friendly message before rethrowing; // exit cleanly instead of trapping on an uncaught top-level throw. - let message = (error as? any LocalizedError)?.errorDescription + let message = + (error as? any LocalizedError)?.errorDescription ?? String(describing: error) - fputs("❌ \(message)\n", stderr) + // Glibc exposes `stderr` as a mutable global, which Swift 6 strict + // concurrency rejects; FileHandle keeps this portable to Linux. + FileHandle.standardError.write(Data("❌ \(message)\n".utf8)) exit(1) } }