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

Provide a way to exempt a terminal from applying any env collections #194819

Closed
Tracked by #22879
karrtikr opened this issue Oct 4, 2023 · 8 comments
Closed
Tracked by #22879

Provide a way to exempt a terminal from applying any env collections #194819

karrtikr opened this issue Oct 4, 2023 · 8 comments
Assignees
Labels
*as-designed Described behavior is as designed feature-request Request for new features or functionality terminal-process Problems launching processes, managing ptys, exiting, process leaks, etc.

Comments

@karrtikr
Copy link
Contributor

karrtikr commented Oct 4, 2023

We can provide:

  • a terminal filter function to decide which terminals environment collection applies to
  • an option to skip env collection in terminal startup options

Primary use case:

With #145234 coming up, we would like to shift some commands which we run as a process to running in terminal instead, but we would like to run those in a deactivated terminal (similar to process spawn), instead of the one where envs are already set.

@meganrogge meganrogge added feature-request Request for new features or functionality terminal-process Problems launching processes, managing ptys, exiting, process leaks, etc. labels Oct 4, 2023
@karrtikr
Copy link
Contributor Author

It was brought to my attention that environment collection isn't applied on hidden terminals:

if (!this._isDisposed && !shellLaunchConfig.strictEnv && !shellLaunchConfig.hideFromUser) {
this._extEnvironmentVariableCollection = this._environmentVariableService.mergedCollection;
this._register(this._environmentVariableService.onDidChangeCollections(newCollection => this._onEnvironmentVariableCollectionChange(newCollection)));

Which means they're deactivated already, so we can directly use them to run commands, i.e this feature should no longer be needed.

@Tyriar
Copy link
Member

Tyriar commented Oct 13, 2023

@karrtikr we could change it as it makes sense to me that hideFromUser would behave the same.

@karrtikr
Copy link
Contributor Author

karrtikr commented Oct 13, 2023

Umm I kind of like it because hidden terminals are generally extension specific (for eg. microsoft/vscode-remote-release#1760), so it does not care for environment collection of other extensions.

(Also, it allows us to workaround this issue 😉)

@karrtikr
Copy link
Contributor Author

karrtikr commented Nov 6, 2023

Reopening this issue as it would seem that we're also deciding to apply environment collection to hidden terminals: #197187 (comment).

@Tyriar
Copy link
Member

Tyriar commented Mar 18, 2024

Closing as hidden terminals will act like regular terminals with #199611 (comment).

@Tyriar Tyriar closed this as completed Mar 18, 2024
@Tyriar Tyriar added the *as-designed Described behavior is as designed label Mar 18, 2024
@karrtikr
Copy link
Contributor Author

If hidden terminal act like regular terminals and start applying environment collection, that is precisely what we want to avoid here. We want to launch a hidden terminal, which has shell integration capacities (fetch command results), but does not apply environment collection. How do we do that?

@karrtikr
Copy link
Contributor Author

Basically, I think the right move should probably be to still have hidden terminals be private (not apply environments from other extensions), while still giving it shell integration capabilities.

@Tyriar
Copy link
Member

Tyriar commented Mar 18, 2024

They can be shown though, a common use case is to create a terminal in the background and show it after some time. It would be a weird inconsistency for that to not act like others.

@microsoft microsoft locked and limited conversation to collaborators Jun 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*as-designed Described behavior is as designed feature-request Request for new features or functionality terminal-process Problems launching processes, managing ptys, exiting, process leaks, etc.
Projects
None yet
Development

No branches or pull requests

3 participants