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

CLI should switch cwd to source dir when ran by Bazel #462

Closed
tscurtu opened this issue Jan 13, 2023 · 1 comment
Closed

CLI should switch cwd to source dir when ran by Bazel #462

tscurtu opened this issue Jan 13, 2023 · 1 comment
Labels
ci Continuous Integration infrastructure cli Command Line Interface good first issue Good for newcomers housekeeping Things that won't impact users, but will impact project devs

Comments

@tscurtu
Copy link
Contributor

tscurtu commented Jan 13, 2023

CLI commands sometimes perform file operations. When ran by Bazel, the cwd is changed to the bazel runtime dir, so relative file paths don't work as intended, and we end up with special treatment like:

    # make sure the file is created in the workspace, and not in the bazel runtime dir
    if not os.path.isabs(file):
        workspace = os.getenv("BUILD_WORKSPACE_DIRECTORY")
        if workspace is not None:
            file = os.path.join(workspace, file)

Always make the CLI switch the cwd to the Bazel root source dir when execute by Bazel, and test that all CLI commands still work as expected.

@tscurtu tscurtu added housekeeping Things that won't impact users, but will impact project devs ci Continuous Integration infrastructure labels Jan 13, 2023
@tscurtu tscurtu added good first issue Good for newcomers cli Command Line Interface labels Nov 13, 2023
@augray
Copy link
Member

augray commented Jan 8, 2025

No longer relevant as of #1145

@augray augray closed this as completed Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci Continuous Integration infrastructure cli Command Line Interface good first issue Good for newcomers housekeeping Things that won't impact users, but will impact project devs
Projects
None yet
Development

No branches or pull requests

2 participants