         CFRunLoopAddSource(managerThreadRunLoop?._cfRunLoop, source, kCFRunLoopDefaultMode)
 
         let fileActions = _CFPosixSpawnFileActionsAlloc()
-        posix(_CFPosixSpawnFileActionsInit(fileActions))
         defer {
             _CFPosixSpawnFileActionsDestroy(fileActions)
             _CFPosixSpawnFileActionsDealloc(fileActions)
         }
+        try _throwIfPosixError(_CFPosixSpawnFileActionsInit(fileActions))
 
         // File descriptors to duplicate in the child process. This allows
         // output redirection to NSPipe or NSFileHandle.

        }

        for (new, old) in adddup2 {
            posix(_CFPosixSpawnFileActionsAddDup2(fileActions, old, new))
        }
        for fd in addclose.filter({ $0 >= 0 }) {
            posix(_CFPosixSpawnFileActionsAddClose(fileActions, fd))
        }

        #if canImport(Darwin)
        var spawnAttrs: posix_spawnattr_t? = nil
        posix_spawnattr_init(&spawnAttrs)
        posix_spawnattr_setflags(&spawnAttrs, .init(POSIX_SPAWN_CLOEXEC_DEFAULT))
        #else
        for fd in 3 ... findMaximumOpenFD() {
            guard adddup2[fd] == nil &&

    #endif

    open func run() throws {

        func _throwIfPosixError(_ posixErrno: Int32) throws {
            if posixErrno != 0 {
                // When this is called, self.executableURL is already known to be non-nil
                let userInfo: [String: Any] = [ NSURLErrorKey: self.executableURL! ]
                throw NSError(domain: NSPOSIXErrorDomain, code: Int(posixErrno), userInfo: userInfo)
            }
        }

        self.processLaunchedCondition.lock()
        defer {
            self.processLaunchedCondition.broadcast()
