Skip to content

Commit e7936a3

Browse files
committed
prevent env var relaunch from extension owned terminals
1 parent 3be37a7 commit e7936a3

File tree

6 files changed

+14
-4
lines changed

6 files changed

+14
-4
lines changed

src/vs/platform/terminal/common/terminal.ts

+5
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,11 @@ export interface IShellLaunchConfig {
230230
* Whether flow control is enabled for this terminal.
231231
*/
232232
flowControl?: boolean;
233+
234+
/**
235+
* Whether this terminal was created by an extension.
236+
*/
237+
isExtensionOwnedTerminal?: boolean;
233238
}
234239

235240
export interface ITerminalEnvironment {

src/vs/workbench/api/browser/mainThreadTerminalService.ts

+1
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ export class MainThreadTerminalService implements MainThreadTerminalServiceShape
131131
strictEnv: launchConfig.strictEnv,
132132
hideFromUser: launchConfig.hideFromUser,
133133
isExtensionTerminal: launchConfig.isExtensionTerminal,
134+
isExtensionOwnedTerminal: launchConfig.isExtensionOwnedTerminal,
134135
extHostTerminalId: extHostTerminalId,
135136
isFeatureTerminal: launchConfig.isFeatureTerminal
136137
};

src/vs/workbench/api/common/extHost.protocol.ts

+1
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,7 @@ export interface TerminalLaunchConfig {
459459
hideFromUser?: boolean;
460460
isExtensionTerminal?: boolean;
461461
isFeatureTerminal?: boolean;
462+
isExtensionOwnedTerminal?: boolean;
462463
}
463464

464465
export interface MainThreadTerminalServiceShape extends IDisposable {

src/vs/workbench/api/common/extHostTerminalService.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,13 @@ export class ExtHostTerminal {
120120
waitOnExit?: boolean,
121121
strictEnv?: boolean,
122122
hideFromUser?: boolean,
123-
isFeatureTerminal?: boolean
123+
isFeatureTerminal?: boolean,
124+
isExtensionOwnedTerminal?: boolean
124125
): Promise<void> {
125126
if (typeof this._id !== 'string') {
126127
throw new Error('Terminal has already been created');
127128
}
128-
await this._proxy.$createTerminal(this._id, { name: this._name, shellPath, shellArgs, cwd, env, waitOnExit, strictEnv, hideFromUser, isFeatureTerminal });
129+
await this._proxy.$createTerminal(this._id, { name: this._name, shellPath, shellArgs, cwd, env, waitOnExit, strictEnv, hideFromUser, isFeatureTerminal, isExtensionOwnedTerminal });
129130
}
130131

131132
public async createExtensionTerminal(): Promise<number> {

src/vs/workbench/api/node/extHostTerminalService.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ export class ExtHostTerminalService extends BaseExtHostTerminalService {
7474
/*options.waitOnExit*/ undefined,
7575
withNullAsUndefined(options.strictEnv),
7676
withNullAsUndefined(options.hideFromUser),
77-
withNullAsUndefined(isFeatureTerminal));
77+
withNullAsUndefined(isFeatureTerminal),
78+
true
79+
);
7880
return terminal.value;
7981
}
8082

src/vs/workbench/contrib/terminal/browser/terminalInstance.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1607,7 +1607,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
16071607

16081608
// Recreate the process if the terminal has not yet been interacted with and it's not a
16091609
// special terminal (eg. task, extension terminal)
1610-
if (info.requiresAction && !this._processManager.hasWrittenData && !this._shellLaunchConfig.isFeatureTerminal && !this._shellLaunchConfig.isExtensionTerminal && !this._shellLaunchConfig.attachPersistentTerminal) {
1610+
if (info.requiresAction && !this._processManager.hasWrittenData && !this._shellLaunchConfig.isFeatureTerminal && !this._shellLaunchConfig.isExtensionTerminal && !this._shellLaunchConfig.isExtensionOwnedTerminal) {
16111611
this.relaunch();
16121612
return;
16131613
}

0 commit comments

Comments
 (0)