Fix inconsistent cwd of run and debug command in client#17275
Merged
bors merged 5 commits intorust-lang:masterfrom May 24, 2024
Merged
Fix inconsistent cwd of run and debug command in client#17275bors merged 5 commits intorust-lang:masterfrom
run and debug command in client#17275bors merged 5 commits intorust-lang:masterfrom
Conversation
Veykril
approved these changes
May 23, 2024
Member
Veykril
left a comment
There was a problem hiding this comment.
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
Contributor
|
☔ The latest upstream changes (presumably #17287) made this pull request unmergeable. Please resolve the merge conflicts. |
Contributor
|
yeah, this seems reasonable to me, I think. |
davidbarsky
approved these changes
May 24, 2024
Member
|
@bors r+ |
Contributor
Contributor
Contributor
|
☀️ Test successful - checks-actions |
This was referenced May 28, 2024
This was referenced Jun 11, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix #17012. Also related to #13022 and #15993.
When the
kindof runnable isbin, Cargo would use the workspace root as the cwd for theruncommand; 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
debugcommand, which led to issue #13022. In this case, during unit testing, theruncommand would use the package root whiledebugwould use the workspace root, causing inconsistency.PR #15993 addressed this problem by using the package root as the cwd for
debugcommand. However, it also resulted in an inconsistency: when executing theruncommand within the main fn of a package (whose target isbin), Cargo would use the workspace root, whereasdebugwould 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
cwdfield withinCargoRunnable, allowing r-a to decide the appropriate cwd depending on the specific kind of the runnable.