mirror of
https://github.com/oven-sh/bun
synced 2026-02-10 19:08:50 +00:00
Co-authored-by: Jarred-Sumner <709451+Jarred-Sumner@users.noreply.github.com> Co-authored-by: Dylan Conway <dylan.conway567@gmail.com>
15 lines
431 B
JavaScript
15 lines
431 B
JavaScript
const { AsyncLocalStorage } = require("async_hooks");
|
|
const dns = require("dns");
|
|
|
|
const asyncLocalStorage = new AsyncLocalStorage();
|
|
|
|
asyncLocalStorage.run({ test: "dns.resolve4" }, () => {
|
|
dns.resolve4("localhost", (err, addresses) => {
|
|
if (asyncLocalStorage.getStore()?.test !== "dns.resolve4") {
|
|
console.error("FAIL: dns.resolve4 callback lost context");
|
|
process.exit(1);
|
|
}
|
|
process.exit(0);
|
|
});
|
|
});
|