diff options
author | Marcos Casagrande <marcoscvp90@gmail.com> | 2020-05-20 01:01:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-19 19:01:06 -0400 |
commit | 62c34bc21e8864ec5701ad493c73224367627580 (patch) | |
tree | 217cf3cf379cd60a3c03c5b0314e7872be27aa75 /std/node/_fs/_fs_close.ts | |
parent | 0fb5f23466a84835cb1b4202d06ec53dc1592961 (diff) |
fix(std/node) improve fs.close compatibility (#5649)
Diffstat (limited to 'std/node/_fs/_fs_close.ts')
-rw-r--r-- | std/node/_fs/_fs_close.ts | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/std/node/_fs/_fs_close.ts b/std/node/_fs/_fs_close.ts index 469bdc77b..cdd815ad9 100644 --- a/std/node/_fs/_fs_close.ts +++ b/std/node/_fs/_fs_close.ts @@ -3,20 +3,14 @@ import { CallbackWithError } from "./_fs_common.ts"; export function close(fd: number, callback: CallbackWithError): void { - new Promise((resolve, reject) => { + queueMicrotask(() => { try { Deno.close(fd); - resolve(); + callback(null); } catch (err) { - reject(err); - } - }) - .then(() => { - callback(); - }) - .catch((err) => { callback(err); - }); + } + }); } export function closeSync(fd: number): void { |