Skip to content

Commit d137aa4

Browse files
committed
Makes the DispatchIO initializer that accepts a path failable, reflecting the fact that a relative or non-existent path is invalid.
(Radar 31115994)
1 parent 1cc64e1 commit d137aa4

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Diff for: src/swift/IO.swift

+13
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public extension DispatchIO {
5555
self.init(__type: type.rawValue, fd: fileDescriptor, queue: queue, handler: cleanupHandler)
5656
}
5757

58+
@available(swift, obsoleted: 4)
5859
public convenience init(
5960
type: StreamType,
6061
path: UnsafePointer<Int8>,
@@ -66,6 +67,18 @@ public extension DispatchIO {
6667
self.init(__type: type.rawValue, path: path, oflag: oflag, mode: mode, queue: queue, handler: cleanupHandler)
6768
}
6869

70+
@available(swift, introduced: 4)
71+
public convenience init?(
72+
type: StreamType,
73+
path: UnsafePointer<Int8>,
74+
oflag: Int32,
75+
mode: mode_t,
76+
queue: DispatchQueue,
77+
cleanupHandler: @escaping (_ error: Int32) -> Void)
78+
{
79+
self.init(__type: type.rawValue, path: path, oflag: oflag, mode: mode, queue: queue, handler: cleanupHandler)
80+
}
81+
6982
public convenience init(
7083
type: StreamType,
7184
io: DispatchIO,

0 commit comments

Comments
 (0)