Uh oh!
There was an error while loading. Please reload this page.
fix(process): improve error message for process.cwd() when directory is deleted - #57184
fix(process): improve error message for process.cwd() when directory is deleted#57184Ankush1oo8 wants to merge 15 commits into
Conversation
Ankush1oo8
commented
Feb 23, 2025
@jasnell can you check this i have done some thing that caused deletion of repo can you now check the pr |
Uh oh!
There was an error while loading. Please reload this page.
Ankush1oo8
commented
Feb 24, 2025
Are there more changes to make |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Ankush1oo8
commented
Feb 25, 2025
@aduh95 can you check for further process to approve |
aduh95
commented
Feb 25, 2025
Any reason you're not taking any of my suggestions? It's certainly fine if you disagree with those, but please at least comment on each explaining why |
Ankush1oo8
commented
Feb 25, 2025
Ohh sorry I think I made the changes but did not commit |
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
Ankush1oo8
commented
Feb 25, 2025
@aduh95 i have made changes according to your suggesations |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@## main #57184 +/- ##
=======================================
Coverage 90.15% 90.15% =======================================
Files 630 630 Lines 186756 186759 +3 Branches 36648 36651 +3 =======================================
+ Hits 168362 168370 +8 - Misses 11193 11201 +8 + Partials 7201 7188 -13
🚀 New features to boost your workflow:
|
Ankush1oo8
commented
Feb 25, 2025
can anyone tell me what should i do now |
addaleax
commented
Feb 26, 2025
@Ankush1oo8 As you can see, GH does point at failures in another test that are definitely related to this change – the exit code is now different in at least one case ( |
Ankush1oo8
commented
Feb 27, 2025
Can you check now |
Ankush1oo8
commented
Feb 28, 2025
@addaleax I don't know what to doi have tried to solve it but did not get any clue |
Ankush1oo8
commented
Mar 1, 2025
i have tried to change the code in test-cwd-enoent-preload.js |
aduh95
commented
Mar 11, 2025
There are lint errors to address |
what should i do about first commit message @aduh95 can help please |
pmarchini
commented
May 1, 2025
Hey @Ankush1oo8, please rewrite your commit history so that it includes only one commit that passes the validations provided here: https://github.com/nodejs/core-validate-commit |
aduh95
commented
Dec 2, 2025
The first commit message is not blocking the merge, whoever lands this can fix that for you. However, the failing tests are blocking, we need to have the tests pass before this can land. |
There was a problem hiding this comment.
I don't think this needs a new semver-major error code.
The original issue #57045 was saying that:
Could be made clearer that this is a failure of process.cwd() as the stack trace makes no mention of it
This is because the stack frame is named as the following. And the error message already said that the cwd is not a file or directory.
Error: ENOENT: no such file or directory, uv_cwd
at process.wrappedCwd [as cwd] (node:internal/bootstrap/switches/does_own_process_state:142:28)
We could just rename the function wrappedCwd to be cwd, and it will solve the issue.
Renegade334
commented
Feb 11, 2026
The associated issue has now been closed, but thanks for the PR! |
This PR improves the error message thrown by
process.cwd()when the current working directory is deleted. Instead of throwing a new error, it enhances the original error message, making it clearer that the directory was deleted while the process was still inside it.Changes Made:
wrappedCwd()to enhance the existing error message forENOENT: uv_cwdinstead of creating a newErrorinstance.process.chdir()to switch directories).Before (Old Behavior):
When the working directory was deleted,
process.cwd()threw a generic error with little context:After (New Behavior):
Now, the error provides a more meaningful message:
Relevant Issue:
(If this PR fixes an issue, add the issue number here)
Example: Fixes#57045
PR-URL:
#57184
Reviewer Notes:
-added to docs