     
     public static let didTerminateNotification = NSNotification.Name(rawValue: "NSTaskDidTerminateNotification")
 }
-    
-private func posix(_ code: Int32, file: StaticString = #file, line: UInt = #line) {
-    switch code {
-    case 0: return
-    case EBADF: fatalError("POSIX command failed with error: \(code) -- EBADF", file: file, line: line)
-    default: fatalError("POSIX command failed with error: \(code)", file: file, line: line)
-    }
-}

        CFRunLoopAddSource(managerThreadRunLoop?._cfRunLoop, source, kCFRunLoopDefaultMode)

        let fileActions = _CFPosixSpawnFileActionsAlloc()
        posix(_CFPosixSpawnFileActionsInit(fileActions))
        defer {
            _CFPosixSpawnFileActionsDestroy(fileActions)
            _CFPosixSpawnFileActionsDealloc(fileActions)
        }

        // File descriptors to duplicate in the child process. This allows
        // output redirection to NSPipe or NSFileHandle.

    #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()
