Skip to content

Commit 0597595

Browse files
authored
Use nonblocking IO for open (#1228)
Windows is blocked by a CI/infra issue. This doesn't affect that code, so merging.
1 parent 68dd6d8 commit 0597595

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Sources/FoundationEssentials/Data/Data+Reading.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,8 @@ internal func readBytesFromFile(path inPath: PathOrURL, reportProgress: Bool, ma
301301
guard let inPathFileSystemRep else {
302302
throw CocoaError(.fileReadInvalidFileName)
303303
}
304-
return open(inPathFileSystemRep, O_RDONLY, 0o666)
304+
// Do not block on opening the file here. If the file is not a regular one, we will produce an error below after `fstat`.
305+
return open(inPathFileSystemRep, O_RDONLY | O_NONBLOCK, 0o666)
305306
}
306307

307308
guard fd >= 0 else {

0 commit comments

Comments
 (0)