From 07fa6fd1a2cb35f1b7a737a0701a866ad9d5f282 Mon Sep 17 00:00:00 2001 From: Vincent Composieux Date: Fri, 4 Sep 2026 21:33:55 +0200 Subject: [PATCH] Fix build on CI: unwrap responsible pid explicitly in AudioApp.running The `responsibleFunction.map { $0(pid) }.flatMap { ... } ?? pid` chain inferred `owner` as a non-optional `pid_t` on Swift 6.3 but as `pid_t?` on the toolchain CI runs, which broke every use of `owner` below it and failed the build (and therefore the test job). Replace the chain with an explicit `responsibleFunction?(pid) ?? 0` and a plain ternary so the type is unambiguous on every Swift version. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_013A9rfM4sZpbLNzgX771ns8 --- Sources/MicroCast/TapCapture.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Sources/MicroCast/TapCapture.swift b/Sources/MicroCast/TapCapture.swift index c6667a8..b2120cc 100644 --- a/Sources/MicroCast/TapCapture.swift +++ b/Sources/MicroCast/TapCapture.swift @@ -55,7 +55,8 @@ struct AudioApp: Identifiable, Hashable { guard (try? CoreAudioProperty.read(objectID, kAudioProcessPropertyPID, into: &pid)) != nil, pid > 0 else { continue } var playing: UInt32 = 0 try? CoreAudioProperty.read(objectID, kAudioProcessPropertyIsRunningOutput, into: &playing) - let owner = responsibleFunction.map { $0(pid) }.flatMap { $0 > 0 ? $0 : nil } ?? pid + let responsible = responsibleFunction?(pid) ?? 0 + let owner: pid_t = responsible > 0 ? responsible : pid let app = NSRunningApplication(processIdentifier: owner) var group = groups[owner] ?? (app?.localizedName ?? processName(owner), app?.bundleIdentifier, false, []) group.playing = group.playing || playing != 0