Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Asynchronously using a synchronous disposable that returns a Promise #2

Open
rictic opened this issue Feb 21, 2025 · 0 comments
Open

Comments

@rictic
Copy link

rictic commented Feb 21, 2025

Describe the bug
A promise returned by a Symbol.dispose method should not be awaited by AsyncDisposableStack.prototype.use

To Reproduce
Steps to reproduce the behavior:

import { AsyncDisposableStack } from "https://deno.land/x/dispose/mod.ts";
{
  const stack = new AsyncDisposableStack();
  const neverResolves = Promise.withResolvers().promise;
  stack.use({[Symbol.dispose]() { return neverResolves }});
  await stack.disposeAsync();
  console.log('[1] does this line of code ever run?'); 
}

Expected behavior
The console log should run. When I tried this polyfill with Deno 2.2.1 the console log statement never ran.

Additional context

tc39/proposal-explicit-resource-management#256

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant