Skip to content

Dedicated Terminal not closing after executing tasks through VSCode extension in version 1.75.0+ #180088

@jpcrs

Description

@jpcrs

Does this issue occur when all extensions are disabled?: Yes/No

  • VS Code Version: 1.75.0+
  • OS Version: Darwin arm64 22.3.0
  • Extensions installed: None

Since the 1.75 release, I have noticed that the dedicated terminal does not close automatically after executing a task through an extension. I am not certain whether this is intended behavior or a bug.

I have checked the VSCode API documentation and it appears that there is no presentation.close method available for use in the extension code, as is available in the task.json file. As a result, I am uncertain whether it is possible to restore the previous behavior or not.

Behaviour on 1.74.3 (Expected):
https://user-images.githubusercontent.com/10402030/232347922-724da345-0e7a-47b1-9b6a-2ac2b3a3cc07.mp4

Behaviour on 1.75.0+ (Not ideal):
https://user-images.githubusercontent.com/10402030/232347956-ac69b24b-de83-4ff2-92ca-848100ff669f.mp4

Minimal extension code to reproduce the problem:

export function activate(context: vscode.ExtensionContext) {
	vscode.tasks.onDidStartTask((e) => {
		if (e.execution.task.name === 'test-task') {
			vscode.tasks.executeTask(new vscode.Task({ type: 'shell' }, vscode.TaskScope.Global, 'test-task', 'test-task', new vscode.ShellExecution('${command:workbench.action.terminal.moveToEditor}')));
			vscode.tasks.executeTask(new vscode.Task({ type: 'shell' }, vscode.TaskScope.Global, 'test-task', 'test-task', new vscode.ShellExecution('${command:workbench.action.closePanel}')));
		}
	});

	let task = new vscode.Task(
		{ type: 'shell' },
		vscode.TaskScope.Workspace,
		'test-task',
		'test-task',
		new vscode.ShellExecution("echo test-task"),
		'$test-task'
	)

	task.presentationOptions = {
		reveal: vscode.TaskRevealKind.Always,
		focus: true,
		panel: vscode.TaskPanelKind.Dedicated,
		showReuseMessage: false,
		clear: true
	}

	task.isBackground = true;

	let disposable = vscode.commands.registerCommand('test-task.helloWorld', () => {
		vscode.tasks.executeTask(task);
	});

	context.subscriptions.push(disposable);
}

Repository with an example to reproduce the problem:
https://github.com/jpcrs/test-task

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bugtasksTask system issuesterminal-editorsverifiedVerification succeeded

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions