-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Fix inconsistent cwd of run
and debug
command in client
#17275
Conversation
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.
Sounds reasonable to me, cc @davidbarsky since you've been dabbling around this area wrt to rust-project.json, probably not too relevant but given #16840 is in a similar-ish vein
☔ The latest upstream changes (presumably #17287) made this pull request unmergeable. Please resolve the merge conflicts. |
yeah, this seems reasonable to me, I think. |
@bors r+ |
☀️ Test successful - checks-actions |
Fix #17012. Also related to #13022 and #15993.
When the
kind
of runnable isbin
, Cargo would use the workspace root as the cwd for therun
command; otherwise, Cargo defaults to the package root as the cwd forrun
.Initially, r-a assumed the workspace root as the cwd for all runnables in
debug
command, which led to issue #13022. In this case, during unit testing, therun
command would use the package root whiledebug
would use the workspace root, causing inconsistency.PR #15993 addressed this problem by using the package root as the cwd for
debug
command. However, it also resulted in an inconsistency: when executing therun
command within the main fn of a package (whose target isbin
), Cargo would use the workspace root, whereasdebug
would use the package root, leading to issue #17012.The preferable approach is to determine the cwd based on the runnable's type. To resolve this, this PR introduces a new
cwd
field withinCargoRunnable
, allowing r-a to decide the appropriate cwd depending on the specific kind of the runnable.