8000 Adding windows support for install_stub by dilanbhalla · Pull Request #21 · github/gh-codeql · GitHub
[go: up one dir, main page]

Skip to content

Adding windows support for install_stub #21

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

dilanbhalla
Copy link

Adding option to install stub for windows (codeql.cmd) so that windows users can use this GitHub managed CLI directly within the terminal or VSCode.

@dilanbhalla dilanbhalla requested a review from a team as a code owner December 14, 2022 05:27
@dilanbhalla
Copy link
Author

I haven't tested this logic, as I am not sure how this is done with GitHub CLI extensions. Just wanted to offer some assistance with this feature. If one of the maintainers can help with running a test, it would be much appreciated. Also, not sure why it is failing the status check, it seems to be downloading some really old 2.6.1 database and throwing some internal CodeQL CLI failure. Would love to get some feedback on these points, thanks in advance!

@aeisenberg
Copy link
Contributor

Thanks for the contribution!

Looks like we're hard-coding a bunch of version numbers in the test and the older version being used is no longer able to run modern queries. I could just change the versions to something more recent, but better would be to get the latest and second latest versions for these tests.

Copy link
Contributor
@aeisenberg aeisenberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks reasonable to me, but I have no way of testing this. Have you tried this out? On MacOS, the extension live in $HOME/.local/share/gh/extensions/gh-codeql. I expect it's similar on windows. I think the best thing to do is manually edit the gh-codeql file to see if it works.

And if you rebase this PR on top of mine, it will be passing.

Copy link
@redsun82 redsun82 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aeisenberg sorry for necroreviewing 😆 maybe we can pick this up? I was just trying to understand if install_stub works on Windows and I stumbled on this. It might be nice to pick this up at a certain point. Maybe I'll give it a spin for a test.


cat << "_codeql_stub" > "$bindir/codeql"
gh codeql %*

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should add an exit /b %ERRORLEVEL% line, otherwise a command failure gets lost

gh codeql %*
_codeql_stub

chmod +x "$bindir/codeql.cmd"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is required for Windows batch files

@aeisenberg
Copy link
Contributor

@redsun82, that would be great. I have no way to test this easily. If you want to take this over and merge when you're comfortable, I would 100% support that.

@rvermeulen
Copy link
Contributor

We should be able to test this in an Action workflow using a Windows runner.

@rvermeulen rvermeulen closed this Jan 17, 2025
@rvermeulen rvermeulen reopened this Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0