diff options
author | Asher Gomez <ashersaupingomez@gmail.com> | 2024-01-25 01:59:55 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-24 15:59:55 +0100 |
commit | 62786cfebb5c9fe36d0930582951f442bdfe9441 (patch) | |
tree | a1bede5492a5b1bf4a202ee8994df027f098e788 /ext/node/polyfills/_fs | |
parent | 4af121687cb4c26f4a2f3e4ad266490d8faa3d2d (diff) |
feat: deprecate `Deno.close()` (#22066)
For removal in Deno v2.
---------
Co-authored-by: Bartek IwaĆczuk <biwanczuk@gmail.com>
Diffstat (limited to 'ext/node/polyfills/_fs')
-rw-r--r-- | ext/node/polyfills/_fs/_fs_close.ts | 9 |
1 files changed, 7 insertions, 2 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); } |