Skip to content

Use exit code for activation, deactivation executeCommand #171

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
wants to merge 6 commits into from

Conversation

anthonykim1
Copy link
Contributor

Resolves: #169

@anthonykim1 anthonykim1 marked this pull request as draft February 7, 2025 19:44
@anthonykim1 anthonykim1 changed the title Use exitCode for activation, deactivation executeCommand Use exit code for activation, deactivation executeCommand Feb 7, 2025
@karthiknadig karthiknadig requested a review from Copilot February 7, 2025 21:51
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (2)

src/features/terminal/terminalActivationState.ts:241

  • Correct the spelling error in the log message: replace 'guarentee' with 'guarantee'.
traceVerbose(`Terminal shell execution returned with undefined. Cannot guarentee activation`,);

src/features/terminal/terminalActivationState.ts:298

  • Correct the spelling error in the log message: replace 'guarentee' with 'guarantee'.
traceVerbose(`Terminal shell execution returned with undefined. Cannot guarentee deactivation`,);

Tip: Copilot only keeps its highest confidence comments to reduce noise and keep you focused. Learn more

@karthiknadig
Copy link
Member

I don't think the changes here dispose correctly. There is nothing stopping the timer calling resolve() after the first thing calls resolve.

@anthonykim1
Copy link
Contributor Author

For some reason I thought Promise.race provided inherent safety against this, but I was wrong :/
Flag should help so we dont get side effect (wrong trace logs saying shell execution timed out)

@karthiknadig
Copy link
Member

You don't need a new variable, the Deferred type already tracks this.

@anthonykim1
Copy link
Contributor Author

Is f1dfbd4 how you do it? @karthiknadig

@karthiknadig
Copy link
Member

Here is how I wanted to refactor it: https://github.com/microsoft/vscode-python-environments/pull/181/files

Either timer or the end event should cause the other to be disposed correctly. In the #181, I also removed the dependency on deferred, extracted common execution code into a separate method (reducing duplication), added additional logging. In the future, when we could handle activation failures.

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.

Leverage execution.exitCode for execution promise resolve
2 participants