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

onDidStartTerminalShellExecution is fired before shellIntegration.executeCommand returns #208650

Closed
jrieken opened this issue Mar 25, 2024 · 0 comments · Fixed by #209044
Closed
Assignees
Labels
api bug Issue identified by VS Code Team member as probable bug insiders-released Patch has been released in VS Code Insiders terminal-shell-integration Shell integration, command decorations, etc. verified Verification succeeded
Milestone

Comments

@jrieken
Copy link
Member

jrieken commented Mar 25, 2024

Testing #208462

  • Have a snippet like below
  • Run the command and notice how onDidStartTerminalShellExecution is fired before the executeCommand returns
  • this makes it impossible to do something special for "your" execution
	vscode.commands.registerCommand('testextension.helloWorld', async (args) => {

		if (!vscode.window.activeTerminal?.shellIntegration) {
			return;
		}

		// const myExec = vscode.window.activeTerminal.shellIntegration.executeCommand('XSW');
		const myExec = vscode.window.activeTerminal.shellIntegration.executeCommand('ls');
		console.log('CREATED', myExec.commandLine)
		active.add(myExec);
	})


	vscode.window.onDidStartTerminalShellExecution(async e => {

		console.log('START', e.commandLine)
		if (active.has(e)) {
			console.log('MY EXEC!')
		}

		active.add(e);

		for await (const item of e.createDataStream()) {
			console.log('CHUNK', item)
		}
	})
@Tyriar Tyriar added bug Issue identified by VS Code Team member as probable bug api terminal-shell-integration Shell integration, command decorations, etc. labels Mar 25, 2024
@Tyriar Tyriar added this to the April 2024 milestone Mar 25, 2024
@VSCodeTriageBot VSCodeTriageBot added the unreleased Patch has not yet been released in VS Code Insiders label Mar 28, 2024
@VSCodeTriageBot VSCodeTriageBot added insiders-released Patch has been released in VS Code Insiders and removed unreleased Patch has not yet been released in VS Code Insiders labels Apr 4, 2024
@jrieken jrieken added the verified Verification succeeded label Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api bug Issue identified by VS Code Team member as probable bug insiders-released Patch has been released in VS Code Insiders terminal-shell-integration Shell integration, command decorations, etc. verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants