Skip to content

Commit 7504155

Browse files
authored
Revert "Remove incorrect guard check for Android (#5171)"
This reverts commit fb8d64d.
1 parent 9dd8777 commit 7504155

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Sources/Foundation/Process.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -942,6 +942,13 @@ open class Process: NSObject, @unchecked Sendable {
942942
var spawnAttrs: posix_spawnattr_t? = nil
943943
#else
944944
var spawnAttrs: posix_spawnattr_t = posix_spawnattr_t()
945+
#endif
946+
#if os(Android)
947+
guard var spawnAttrs else {
948+
throw NSError(domain: NSPOSIXErrorDomain, code: Int(errno), userInfo: [
949+
NSURLErrorKey:self.executableURL!
950+
])
951+
}
945952
#endif
946953
try _throwIfPosixError(posix_spawnattr_init(&spawnAttrs))
947954
try _throwIfPosixError(posix_spawnattr_setflags(&spawnAttrs, .init(POSIX_SPAWN_SETPGROUP)))

0 commit comments

Comments
 (0)