Skip to content

Improve support for running in Codespaces #945

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

Closed
markphip opened this issue Nov 3, 2022 · 1 comment
Closed

Improve support for running in Codespaces #945

markphip opened this issue Nov 3, 2022 · 1 comment
Labels
enhancement New feature or request integration Related to integration with another tool, IDE or environment
Milestone

Comments

@markphip
Copy link

markphip commented Nov 3, 2022

Feature description
GCM sort of works if run in Codespaces (with Azure DevOps). First off, it uses devicecode flow. This works fine if you use git from the VS Code Terminal. Once you do this, as long as you have some kind of caching enabled, the VS Code GUI will also work.

If you start in the VS Code GUI then it does not work. GCM sends the device code information to /dev/tty but VS Code is not trying to capture this or show it to the user so it is not possible to see the output. I modified the GCM code to output to stderr instead and this almost works. This output does get captured by VS Code and displayed in their Git Output window. However, it does not output anything until the command fails. I glanced at the VS Code source code and it seems like it always runs Git operations in a try/catch so while it does capture stderr it does not look at the output until the operation completes.

Shifting gears, I tried another approach. In GCM, I added a quick hack to also write dcr.Message to a text file in $HOME/.somedir. I then used a VS Code extension to monitor this folder and when the text file arrives it displays the information to the user ins VS Code. I think a better option would be to serialize the entire dcr object to JSON so that the receiver would have more flexibility in how it displays the URL and Code to the user.

What I am asking for? Could be one of a number of approaches:

  1. Let me register a helper script with GCM that is called for the DeviceCode flow. This would pass me the JSON object and then it would be up to me to implement some kind of solution that would relay the information to the VS Code UI. Perhaps using a variant of my hack, perhaps something better.
  2. Another option might be to just have a setting that tells GCM to output a text file like I did in my hack. The helper script approach seems better as worst case a simple bash script could create this text file but maybe a better option could be found.
  3. You should investigate whether you should be writing to stderr instead of /dev/tty. Maybe there is at least a way to recognize if nothing is attached to tty and then use stderr? It is unclear if VS Code will ever handle any of this better but this would at least give it a chance. Using stderr seemed to work fine.
@markphip markphip added the enhancement New feature or request label Nov 3, 2022
@mjcheetham mjcheetham added this to the Git 2.41 milestone Feb 7, 2023
@mjcheetham mjcheetham added the integration Related to integration with another tool, IDE or environment label Feb 7, 2023
@ldennington ldennington modified the milestones: Git 2.41, Git 2.42 Apr 10, 2023
@ldennington
Copy link
Contributor

Closing - requestor has switched to a different solution that better meets their customers' needs.

@ldennington ldennington closed this as not planned Won't fix, can't repro, duplicate, stale May 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request integration Related to integration with another tool, IDE or environment
Projects
None yet
Development

No branches or pull requests

3 participants