Skip to content

Commit b281c51

Browse files
ktopley-appledas
authored andcommitted
Makes the DispatchIO initializer that accepts a path failable, reflecting the fact that a relative or non-existent path is invalid.
(Radar 31115994) Signed-off-by: Daniel A. Steffen <dsteffen@apple.com>
1 parent 3b5ffaf commit b281c51

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

PATCHES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,3 +320,4 @@ github commits starting with 29bdc2f from
320320
[b6f8908] APPLIED rdar://32283666
321321
[a6c16d0] APPLIED rdar://32283666
322322
[1cc64e1] APPLIED rdar://32283666
323+
[d137aa4] APPLIED rdar://32283666

src/swift/IO.swift

Lines changed: 13 additions & 0 deletions
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)