mirror of
https://github.com/stablyai/orca.git
synced 2026-09-22 16:02:32 +00:00
## Summary - stop the macOS helper from unlinking caller-supplied socket and token paths - keep parent-owned token cleanup tied to the helper startup that created it - fail closed for non-socket socket-path collisions and cover helper cleanup races with regression tests ## Verification - swift test --package-path native/computer-use-macos - pnpm exec vitest run --config config/vitest.config.ts src/main/computer/macos-native-provider-client.test.ts - pnpm run typecheck:node - pnpm lint - pnpm run build:computer-macos - Electron/helper startup smoke validation
15 lines
398 B
Swift
15 lines
398 B
Swift
import Darwin
|
|
|
|
public enum UnixSocketPathSafety {
|
|
public static func isSocketMode(_ mode: mode_t) -> Bool {
|
|
(mode & mode_t(S_IFMT)) == mode_t(S_IFSOCK)
|
|
}
|
|
|
|
public static func shouldRejectExistingPathAfterBindFailure(
|
|
bindErrno: Int32,
|
|
existingMode: mode_t?
|
|
) -> Bool {
|
|
bindErrno == EADDRINUSE && existingMode.map { !isSocketMode($0) } == true
|
|
}
|
|
}
|