mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 18:38:55 +00:00
20 lines
587 B
JavaScript
20 lines
587 B
JavaScript
process.exitCode = 1;
|
|
const { AsyncLocalStorage } = require("async_hooks");
|
|
const fs = require("fs");
|
|
const path = require("path");
|
|
|
|
const asyncLocalStorage = new AsyncLocalStorage();
|
|
const testFile = path.join(fs.mkdtempSync("unlink-test"), "unlink-test-" + Date.now() + ".txt");
|
|
|
|
fs.writeFileSync(testFile, "test");
|
|
|
|
asyncLocalStorage.run({ test: "fs.unlink" }, () => {
|
|
fs.unlink(testFile, err => {
|
|
if (asyncLocalStorage.getStore()?.test !== "fs.unlink") {
|
|
console.error("FAIL: fs.unlink callback lost context");
|
|
process.exit(1);
|
|
}
|
|
process.exit(0);
|
|
});
|
|
});
|