From f4d2382d9e61d6fda580b7a5afb37699a0015745 Mon Sep 17 00:00:00 2001 From: Harikrishnan Balagopal Date: Tue, 10 Oct 2023 16:49:21 +0530 Subject: [PATCH] fix: bug where os.Stat on a non-existent file would return "File exists" error Signed-off-by: Harikrishnan Balagopal --- src/fs_fd.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fs_fd.ts b/src/fs_fd.ts index 918d4e2..104958f 100644 --- a/src/fs_fd.ts +++ b/src/fs_fd.ts @@ -227,7 +227,7 @@ export class OpenDirectory extends Fd { ): { ret: number; filestat: wasi.Filestat | null } { const entry = this.dir.get_entry_for_path(path); if (entry == null) { - return { ret: wasi.ERRNO_EXIST, filestat: null }; + return { ret: wasi.ERRNO_NOENT, filestat: null }; } return { ret: 0, filestat: entry.stat() }; }