Skip to content

Commit

Permalink
rename to withFileHandle
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-fowler committed Nov 9, 2023
1 parent c9d8ec6 commit dc2c3b1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Sources/NIOPosix/NonBlockingFileIO.swift
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,7 @@ extension NonBlockingFileIO {
/// - mode: File access mode.
/// - flags: Additional POSIX flags.
/// - returns: NIOFileHandle`.
public func withOpenFile<Result>(
public func withFileHandle<Result>(
path: String,
mode: NIOFileHandle.Mode,
flags: NIOFileHandle.Flags = .default,
Expand Down
22 changes: 11 additions & 11 deletions Tests/NIOPosixTests/NonBlockingFileIOTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1330,7 +1330,7 @@ extension NonBlockingFileIOTest {

func testAsyncOpeningFilesForWriting() async throws {
try await withTemporaryDirectory { dir in
try await self.fileIO!.withOpenFile(
try await self.fileIO!.withFileHandle(
path: "\(dir)/file",
mode: .write,
flags: .allowFileCreation()
Expand All @@ -1341,7 +1341,7 @@ extension NonBlockingFileIOTest {
func testAsyncOpeningFilesForWritingFailsIfWeDontAllowItExplicitly() async throws {
do {
try await withTemporaryDirectory { dir in
try await self.fileIO!.withOpenFile(
try await self.fileIO!.withFileHandle(
path: "\(dir)/file",
mode: .write,
flags: .default
Expand All @@ -1355,7 +1355,7 @@ extension NonBlockingFileIOTest {

func testAsyncOpeningFilesForWritingDoesNotAllowReading() async throws {
try await withTemporaryDirectory { dir in
try await self.fileIO!.withOpenFile(
try await self.fileIO!.withFileHandle(
path: "\(dir)/file",
mode: .write,
flags: .allowFileCreation()
Expand All @@ -1373,7 +1373,7 @@ extension NonBlockingFileIOTest {

func testAsyncOpeningFilesForWritingAndReading() async throws {
try await withTemporaryDirectory { dir in
try await self.fileIO!.withOpenFile(
try await self.fileIO!.withFileHandle(
path: "\(dir)/file",
mode: [.write, .read],
flags: .allowFileCreation()
Expand All @@ -1393,7 +1393,7 @@ extension NonBlockingFileIOTest {
try await withTemporaryDirectory { dir in
// open 1 + write
do {
try await self.fileIO.withOpenFile(
try await self.fileIO.withFileHandle(
path: "\(dir)/file",
mode: [.write, .read],
flags: .allowFileCreation()
Expand All @@ -1410,7 +1410,7 @@ extension NonBlockingFileIOTest {

// open 2 + write again + read
do {
try await self.fileIO!.withOpenFile(
try await self.fileIO!.withFileHandle(
path: "\(dir)/file",
mode: [.write, .read],
flags: .default
Expand Down Expand Up @@ -1443,7 +1443,7 @@ extension NonBlockingFileIOTest {
try await withTemporaryDirectory { dir in
// open 1 + write
do {
try await self.fileIO!.withOpenFile(
try await self.fileIO!.withFileHandle(
path: "\(dir)/file",
mode: [.write, .read],
flags: .allowFileCreation()
Expand All @@ -1459,7 +1459,7 @@ extension NonBlockingFileIOTest {
}
// open 2 (with truncation) + write again + read
do {
try await self.fileIO!.withOpenFile(
try await self.fileIO!.withFileHandle(
path: "\(dir)/file",
mode: [.write, .read],
flags: .posix(flags: O_TRUNC, mode: 0)
Expand Down Expand Up @@ -1587,7 +1587,7 @@ extension NonBlockingFileIOTest {
func testAsyncListDirectory() async throws {
try await withTemporaryDirectory { path in
let file = "\(path)/file"
try await self.fileIO.withOpenFile(
try await self.fileIO.withFileHandle(
path: file,
mode: .write,
flags: .allowFileCreation()
Expand All @@ -1601,7 +1601,7 @@ extension NonBlockingFileIOTest {
func testAsyncRename() async throws {
try await withTemporaryDirectory { path in
let file = "\(path)/file"
try await self.fileIO.withOpenFile(
try await self.fileIO.withFileHandle(
path: file,
mode: .write,
flags: .allowFileCreation()
Expand All @@ -1628,7 +1628,7 @@ extension NonBlockingFileIOTest {
func testAsyncRemove() async throws {
try await withTemporaryDirectory { path in
let file = "\(path)/file"
try await self.fileIO.withOpenFile(
try await self.fileIO.withFileHandle(
path: file,
mode: .write,
flags: .allowFileCreation()
Expand Down

0 comments on commit dc2c3b1

Please sign in to comment.