-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
src: include cwd in chdir error message #21526
Conversation
Include the current working directory in the error message for a failing `process.chdir()` since that is usually information relevant for debugging. This is semver-major because it moves properties of the error message object. Inspired by nodejs/help#1355.
This needs another @nodejs/tsc review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM if CI comes back OK
Resume Build for CI: https://ci.nodejs.org/job/node-test-pull-request/15697/ |
Resume Build did not work out. Let's try this instead for the only failed platform (Windows): https://ci.nodejs.org/job/node-test-commit-windows-fanned/19064/ EDIT: Green! All good on CI front. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with a question about a potential edge case
// be helpful information when debugging a `chdir()` failure. | ||
char buf[CHDIR_BUFSIZE]; | ||
size_t cwd_len = sizeof(buf); | ||
uv_cwd(buf, &cwd_len); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible that uv_cwd
here returns something different from the original cwd? (I am thinking about Windows since libuv calls SetCurrentDirectoryW
after SetCurrentDirectoryW
and SetEnvironmentVariableW
might fail even after SetCurrentDirectoryW
succeeds)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@joyeecheung I guess so? It’s not really clear to me how SetEnvironmentVariableW
could fail with a runtime error…
I don’t think we really need to worry about it? It’s going to be pretty rare, I think
Landed in cf37945 |
Include the current working directory in the error message for a failing `process.chdir()` since that is usually information relevant for debugging. This is semver-major because it moves properties of the error message object. Inspired by nodejs/help#1355. PR-URL: #21526 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Joyee Cheung <[email protected]>
Include the current working directory in the error
message for a failing
process.chdir()
since that isusually information relevant for debugging.
This is semver-major because it moves properties
of the error message object.
Inspired by nodejs/help#1355.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes