Skip to content
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

Merged
merged 5 commits into from
May 24, 2024

Conversation

roife
Copy link
Contributor

@roife roife commented May 22, 2024

Fix #17012. Also related to #13022 and #15993.

When the kind of runnable is bin, Cargo would use the workspace root as the cwd for the run command; otherwise, Cargo defaults to the package root as the cwd for run.

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, the run command would use the package root while debug 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 the run command within the main fn of a package (whose target is bin), Cargo would use the workspace root, whereas debug 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 within CargoRunnable, allowing r-a to decide the appropriate cwd depending on the specific kind of the runnable.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 22, 2024
Copy link
Member

@Veykril Veykril left a 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

@bors
Copy link
Collaborator

bors commented May 23, 2024

☔ The latest upstream changes (presumably #17287) made this pull request unmergeable. Please resolve the merge conflicts.

@davidbarsky
Copy link
Contributor

yeah, this seems reasonable to me, I think.

@Veykril
Copy link
Member

Veykril commented May 24, 2024

@bors r+

@bors
Copy link
Collaborator

bors commented May 24, 2024

📌 Commit a8031e3 has been approved by Veykril

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented May 24, 2024

⌛ Testing commit a8031e3 with merge a55e8bf...

@bors
Copy link
Collaborator

bors commented May 24, 2024

☀️ Test successful - checks-actions
Approved by: Veykril
Pushing a55e8bf to master...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Run and Debug codelens link buttons for main (non test) entry point launch with differing cwd paths
5 participants