bazelbuild / intellij

IntelliJ plugin for Bazel projects
https://ij.bazel.build/
Apache License 2.0
752 stars 296 forks source link

Current directory not correctly set when debugging #4151

Open FHowington opened 1 year ago

FHowington commented 1 year ago

Description of the bug:

When debugging bazel targets from Pycharm, the current working directory is set to the project root directory. This is different from when bazel run is used directly, where the current directory is in the runfiles tree. This is causing problems finding resources in the runfiles tree using relative paths.

This is the same issue as https://github.com/bazelbuild/intellij/issues/319, filed against the clion plugin.

For example bazel run OR run it directly from pycharm: CWD is bazel cache/4254edf45eea7a9dd5daebbc8928ade6/execroot/project/bazel-out/k8-dbg/bin/binary path/test.runfiles/

But when running debug from Pycharm: CWD is project root

The expected behavior that the launched process would have the same working directory in both cases, in the runfiles tree.

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

Attempt to debug any target that relies of relative paths of data dependencies pulled in by bazel

Which Intellij IDE are you using? Please provide the specific version.

Pycharm version: 2022.2.4 CE

What programming languages and tools are you using? Please provide specific versions.

python 3.9

What Bazel plugin version are you using?

Bazel plugin version: 2022.11.01.0.1-api-version-222

Have you found anything relevant by searching the web?

Yes https://github.com/bazelbuild/intellij/issues/319

Any other information, logs, or outputs that you want to share?

No response

jam643 commented 1 year ago

I have this issue too!

JRodDynamite commented 1 year ago

Is there a workaround for this for now? My code points to certain config files (using relative path) which it is unable to find because the debugger defaults to root directory.

github-actions[bot] commented 5 months ago

Thank you for contributing to the IntelliJ repository! This issue has been marked as stale since it has not had any activity in the last 6 months. It will be closed in the next 14 days unless any other activity occurs or one of the following labels is added: "not stale", "awaiting-maintainer". Please reach out to the triage team (@bazelbuild/triage) if you think this issue is still relevant or you are interested in getting the issue resolved.

github-actions[bot] commented 4 months ago

This issue has been automatically closed due to inactivity. If you're still interested in pursuing this, please post @bazelbuild/triage in a comment here and we'll take a look. Thanks!

lamcw commented 2 months ago

@bazelbuild/triage