Skip to content

The shellIntegration.env object allows for modifications #241850

@jrieken

Description

@jrieken

Testing #241722

Have a snippet like this and notice how the first listener influences what the second sees. The event and object should be protected from unwanted modifications, like use Object.freeze and JS getter functions

	vscode.window.onDidChangeTerminalShellIntegration(e => {

		// console.log(e.shellIntegration.env);

		if (!e.shellIntegration.env || !e.shellIntegration.env.value) {
			console.log('no shell env')
			return
		}

		console.log(`ENV: isTrusted?${e.shellIntegration.env.isTrusted}`);
		e.shellIntegration.env.isTrusted = true
		console.log(`ENV: isTrusted?${e.shellIntegration.env.isTrusted}`);

	});

// second listener
	vscode.window.onDidChangeTerminalShellIntegration(e => {

		if (!e.shellIntegration.env || !e.shellIntegration.env.value) {
			return
		}
		console.log(`ENV: isTrusted2?${e.shellIntegration.env.isTrusted}`);

	});

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bugimportantIssue identified as high-priorityinsiders-releasedPatch has been released in VS Code Insidersterminal-shell-integrationShell integration infrastructure, command decorations, etc.verification-neededVerification of issue is requestedverifiedVerification succeeded

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions