Skip to content

Commit 7124bf4

Browse files
committed
fs: add stacktrace to fs/promises
nodejs/node#49849
1 parent 0059ab0 commit 7124bf4

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

lib/node/asar-fs-wrapper.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
494494
};
495495

496496
const { access } = fs;
497-
fs.access = function (pathArgument: string, mode: any, callback: any) {
497+
fs.access = function (pathArgument: string, mode: number, callback: any) {
498498
const pathInfo = splitPath(pathArgument);
499499
if (!pathInfo.isAsar) return access.apply(this, arguments);
500500
const { asarPath, filePath } = pathInfo;
@@ -539,7 +539,16 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
539539
nextTick(callback);
540540
};
541541

542-
fs.promises.access = util.promisify(fs.access);
542+
const { access: accessPromise } = fs.promises;
543+
fs.promises.access = function (pathArgument: string, mode: number) {
544+
const pathInfo = splitPath(pathArgument);
545+
if (!pathInfo.isAsar) {
546+
return accessPromise.apply(this, arguments);
547+
}
548+
549+
const p = util.promisify(fs.access);
550+
return p(pathArgument, mode);
551+
};
543552

544553
const { accessSync } = fs;
545554
fs.accessSync = function (pathArgument: string, mode: any) {

0 commit comments

Comments
 (0)