Open
Description
Previous ID | SR-14669 |
Radar | rdar://problem/78626941 |
Original Reporter | @tomerd |
Type | Bug |
Additional Detail from JIRA
Votes | 1 |
Component/s | Foundation |
Labels | Bug, Linux, Windows |
Assignee | None |
Priority | Medium |
md5: 30e74c22b4f95eebac2ef61ab1954b5f
Issue Description:
The following code handles pipe input.
Based on the documentation, when `availableData` length is 0, it means the end of the pipe has been reached and the read operation is complete. Hover, we seen the handler get called with zero length availableData multiple times, which seems like a bug.
let stdoutPipe = Pipe()
stdoutPipe.fileHandleForReading.readabilityHandler = { (fh : FileHandle) -> Void in
let data = fh.availableData
if (data.count == 0) {
print("finished")
}
}