Skip to content

Start workspaces by shelling out to CLI #400

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

Merged
merged 6 commits into from
Dec 6, 2024

Conversation

aaronlehmann
Copy link
Contributor

Replace the REST-API-based start flow with one that shells out to the coder CLI.

Replace the REST-API-based start flow with one that shells out to the
coder CLI.

Signed-off-by: Aaron Lehmann <[email protected]>
Copy link
Member

@code-asher code-asher left a comment

Choose a reason for hiding this comment

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

Thank you for putting this together! Just to test, I hard-coded --global-config and it worked great, so that is the only thing we really need to figure out.

@aaronlehmann
Copy link
Contributor Author

Thanks for reviewing! I'm traveling right now but will come back to this in early December.

Copy link
Member

@code-asher code-asher left a comment

Choose a reason for hiding this comment

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

Looks and works great! The only thing is that it asked me to log in again, which I think is just because of the missing await, the next line checked for session but it had not been renamed yet. Subsequent runs are working wonderfully.

src/storage.ts Outdated
Comment on lines 511 to 513
await fs.stat(oldTokenPath)
const newTokenPath = this.getSessionTokenPath(label)
await fs.rename(oldTokenPath, newTokenPath)
Copy link
Member

Choose a reason for hiding this comment

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

Not a blocker at all, just wanted to mention that stat is often an anti-pattern; because rename can also throw ENOENT and there is technically no guarantee the file still exists between the stat and rename, it is always necessary to check the error of rename anyway, so might as well do it with one call.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, that makes sense. Removed the stat.

Copy link
Member

@code-asher code-asher left a comment

Choose a reason for hiding this comment

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

Thank you! After merging I will cut a new release.

@code-asher code-asher merged commit f4eeb36 into coder:main Dec 6, 2024
2 checks passed
aaronlehmann added a commit to aaronlehmann/jetbrains-coder that referenced this pull request Dec 24, 2024
Replace the REST-API-based start flow with one that shells out to the
coder CLI.

This is the JetBrains extension equivalent to
coder/vscode-coder#400.
code-asher pushed a commit to coder/jetbrains-coder that referenced this pull request Jan 3, 2025
Replace the REST-API-based start flow with one that shells out to the
coder CLI.

This is the JetBrains extension equivalent to
coder/vscode-coder#400.
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.

2 participants