process: improve process.cwd() error message · nodejs/node@ca5c4c9 · GitHub
Skip to content

Commit ca5c4c9

Browse files
TseianRafaelGSS
authored andcommitted
process: improve process.cwd() error message
PR-URL: #61164 Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: theanarkh <theratliter@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
1 parent 9b136db commit ca5c4c9

3 files changed

Lines changed: 43 additions & 3 deletions

File tree

src/node_process_methods.cc

Lines changed: 10 additions & 2 deletions

test/known_issues/test-cwd-enoent-file.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ if (process.argv[2] === 'child') {
2323
process.chdir(dir);
2424
fs.rmdirSync(dir);
2525
assert.throws(process.cwd,
26-
/^Error: ENOENT: no such file or directory, uv_cwd$/);
26+
/^Error: ENOENT: process\.cwd failed with error no such file or directory, the current working directory was likely removed without changing the working directory, uv_cwd$/);
2727

2828
const r = cp.spawnSync(process.execPath, [__filename, 'child']);
2929

Lines changed: 32 additions & 0 deletions

0 commit comments

Comments
 (0)