From ca42ca2269d6697c225c600ed90cde4ffe2beaeb Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Thu, 25 Sep 2025 03:49:41 -0700 Subject: [PATCH] Accommodate Android, where posix_spawnattr_t and posix_spawn_file_actions_t are opaque pointers This is needed to compile on the Android platform. --- Sources/TSCBasic/Process/Process.swift | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Sources/TSCBasic/Process/Process.swift b/Sources/TSCBasic/Process/Process.swift index fb35a1cd..bd946b88 100644 --- a/Sources/TSCBasic/Process/Process.swift +++ b/Sources/TSCBasic/Process/Process.swift @@ -626,7 +626,9 @@ public final class Process { return stdinPipe.fileHandleForWriting #elseif (!canImport(Darwin) || os(macOS)) // Initialize the spawn attributes. - #if canImport(Darwin) || os(Android) || os(OpenBSD) || os(FreeBSD) + #if os(Android) + var attributes: posix_spawnattr_t! = nil + #elseif canImport(Darwin) || os(OpenBSD) || os(FreeBSD) var attributes: posix_spawnattr_t? = nil #else var attributes = posix_spawnattr_t() @@ -671,7 +673,9 @@ public final class Process { posix_spawnattr_setflags(&attributes, Int16(flags)) // Setup the file actions. - #if canImport(Darwin) || os(Android) || os(OpenBSD) || os(FreeBSD) + #if os(Android) + var fileActions: posix_spawn_file_actions_t! = nil + #elseif canImport(Darwin) || os(OpenBSD) || os(FreeBSD) var fileActions: posix_spawn_file_actions_t? = nil #else var fileActions = posix_spawn_file_actions_t()