Makes the DispatchIO initializer that accepts a path failable, reflecting the fact that a relative or non-existent path is invalid.
(Radar 31115994)
diff --git a/src/swift/IO.swift b/src/swift/IO.swift
index 8ce417a..d26f641 100644
--- a/src/swift/IO.swift
+++ b/src/swift/IO.swift
@@ -55,6 +55,7 @@
self.init(__type: type.rawValue, fd: fileDescriptor, queue: queue, handler: cleanupHandler)
}
+ @available(swift, obsoleted: 4)
public convenience init(
type: StreamType,
path: UnsafePointer<Int8>,
@@ -66,6 +67,18 @@
self.init(__type: type.rawValue, path: path, oflag: oflag, mode: mode, queue: queue, handler: cleanupHandler)
}
+ @available(swift, introduced: 4)
+ public convenience init?(
+ type: StreamType,
+ path: UnsafePointer<Int8>,
+ oflag: Int32,
+ mode: mode_t,
+ queue: DispatchQueue,
+ cleanupHandler: @escaping (_ error: Int32) -> Void)
+ {
+ self.init(__type: type.rawValue, path: path, oflag: oflag, mode: mode, queue: queue, handler: cleanupHandler)
+ }
+
public convenience init(
type: StreamType,
io: DispatchIO,