diff options
Diffstat (limited to 'ext/node')
-rw-r--r-- | ext/node/polyfills/_fs/_fs_close.ts | 9 | ||||
-rw-r--r-- | ext/node/polyfills/internal/fs/handle.ts | 3 |
2 files changed, 9 insertions, 3 deletions
diff --git a/ext/node/polyfills/_fs/_fs_close.ts b/ext/node/polyfills/_fs/_fs_close.ts index 9938668b3..fd01a0336 100644 --- a/ext/node/polyfills/_fs/_fs_close.ts +++ b/ext/node/polyfills/_fs/_fs_close.ts @@ -5,13 +5,16 @@ import type { CallbackWithError } from "ext:deno_node/_fs/_fs_common.ts"; import { getValidatedFd } from "ext:deno_node/internal/fs/utils.mjs"; +import { core } from "ext:core/mod.js"; export function close(fd: number, callback: CallbackWithError) { fd = getValidatedFd(fd); setTimeout(() => { let error = null; try { - Deno.close(fd); + // TODO(@littledivy): Treat `fd` as real file descriptor. `rid` is an + // implementation detail and may change. + core.close(fd); } catch (err) { error = err instanceof Error ? err : new Error("[non-error thrown]"); } @@ -21,5 +24,7 @@ export function close(fd: number, callback: CallbackWithError) { export function closeSync(fd: number) { fd = getValidatedFd(fd); - Deno.close(fd); + // TODO(@littledivy): Treat `fd` as real file descriptor. `rid` is an + // implementation detail and may change. + core.close(fd); } diff --git a/ext/node/polyfills/internal/fs/handle.ts b/ext/node/polyfills/internal/fs/handle.ts index b0097b424..ce218f24e 100644 --- a/ext/node/polyfills/internal/fs/handle.ts +++ b/ext/node/polyfills/internal/fs/handle.ts @@ -12,6 +12,7 @@ import { ReadOptions, TextOptionsArgument, } from "ext:deno_node/_fs/_fs_common.ts"; +import { core } from "ext:core/mod.js"; interface WriteResult { bytesWritten: number; @@ -134,7 +135,7 @@ export class FileHandle extends EventEmitter { close(): Promise<void> { // Note that Deno.close is not async - return Promise.resolve(Deno.close(this.fd)); + return Promise.resolve(core.close(this.fd)); } } |