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

Debug use cargo workspace root as cwd #15993

Merged
merged 1 commit into from
Nov 30, 2023

Conversation

meowtec
Copy link
Contributor

@meowtec meowtec commented Nov 30, 2023

fixes #13022

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 30, 2023
@meowtec meowtec changed the title Debug use cargo workspace root as cwd. fixes #13022 Debug use cargo workspace root as cwd. fixes #13022 Nov 30, 2023
@meowtec meowtec force-pushed the fix/workspaces-debug-cwd branch from 606d883 to 4ca86ed Compare November 30, 2023 11:22
@Veykril Veykril changed the title Debug use cargo workspace root as cwd. fixes #13022 Debug use cargo workspace root as cwd Nov 30, 2023
@Veykril
Copy link
Member

Veykril commented Nov 30, 2023

Thanks!
@bors r+

@bors
Copy link
Contributor

bors commented Nov 30, 2023

📌 Commit 4ca86ed has been approved by Veykril

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Nov 30, 2023

⌛ Testing commit 4ca86ed with merge c9d189d...

@lnicola
Copy link
Member

lnicola commented Nov 30, 2023

changelog fix (first contribution) use package root as working directory when launching the debugger

@bors
Copy link
Contributor

bors commented Nov 30, 2023

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

@bors bors merged commit c9d189d into rust-lang:master Nov 30, 2023
9 checks passed
bors added a commit that referenced this pull request May 24, 2024
Fix inconsistent cwd of `run` and `debug` command in client

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.
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.

VSCode "Debug" test cwd is workspace root, not package root for tests
5 participants