Skip to content

Conversation

@Tseian
Copy link

@Tseian Tseian commented Dec 24, 2025

Issue

#57045

Description

Improves the error message when process.cwd() failed by adding prefix err message 'process.cwd failed with error' if call uv_cwd failed

Before

Error: ENOENT: no such file or directory, uv_cwd

After

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

Changes

  • src/node_process_methods.cc

Test

  • test/known_issues/test-cwd-enoent-file.js
  • test/parallel/test-cwd-enoent-improved-message.js

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. labels Dec 24, 2025
@codecov
Copy link

codecov bot commented Dec 24, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.52%. Comparing base (732ab9d) to head (24218bf).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #61164      +/-   ##
==========================================
- Coverage   92.22%   88.52%   -3.70%     
==========================================
  Files         343      703     +360     
  Lines      139240   208592   +69352     
  Branches    22253    40226   +17973     
==========================================
+ Hits       128413   184661   +56248     
- Misses      10600    15949    +5349     
- Partials      227     7982    +7755     
Files with missing lines Coverage Δ
src/node_process_methods.cc 88.86% <100.00%> (ø)

... and 478 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Tseian
Copy link
Author

Tseian commented Dec 24, 2025

@theanarkh @joyeecheung Please trigger the ci to check again.

@Tseian
Copy link
Author

Tseian commented Dec 25, 2025

@joyeecheung @legendecas @Qard @theanarkh Pls code review this pr

@Qard
Copy link
Member

Qard commented Dec 25, 2025

My thinking with reporting the issue initially was that we could provide a bit more expanded context explaining what the cause could be, like stating that the current working directory was likely removed without changing the working directory to something else. It's already I think obvious enough that the error is coming from a cwd() call. What's not obvious is why.

@Tseian
Copy link
Author

Tseian commented Dec 25, 2025

My thinking with reporting the issue initially was that we could provide a bit more expanded context explaining what the cause could be, like stating that the current working directory was likely removed without changing the working directory to something else. It's already I think obvious enough that the error is coming from a cwd() call. What's not obvious is why.

@Qard So, would changing the error message to "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" achieve it?

@Qard
Copy link
Member

Qard commented Dec 25, 2025

That sounds reasonable to me. 🙂

@Tseian
Copy link
Author

Tseian commented Dec 25, 2025

That sounds reasonable to me. 🙂

Got it. I will commit it soon.

@Tseian
Copy link
Author

Tseian commented Dec 26, 2025

@Qard Hi, I have committed it. Please have a code review for it, and if there is no issue please trigger the CI to check again.

@Tseian
Copy link
Author

Tseian commented Dec 27, 2025

@Qard If you have time, please help trigger a CI to check and review the pr. Thank you very much😊.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants