Skip to content

Tasks (and TaskExecutions) are not === in the onDid(Start|End)Task callbacks. #96643

@ashgti

Description

@ashgti
  • VSCode Version: 1.44.2
  • OS Version: macOS 10.5.4

Steps to Reproduce:

  1. Create a new extension using yo code.
  2. Add the following to the 'activate' function body:
	let disposable = vscode.commands.registerCommand('extension.helloWorld', async () => {
		let echoTask = new vscode.Task({type: "taskbug"}, vscode.TaskScope.Workspace, 'echo', 'taskbug', new vscode.ProcessExecution('/bin/echo', ['hello world']));

		const echoTaskExecution = await vscode.tasks.executeTask(echoTask);

		vscode.tasks.onDidStartTaskProcess(e => {
			if (e.execution === echoTaskExecution) {
				console.log(`Detected that my task started with pid ${e.processId}`);
			} else if (e.execution.task === echoTask) {
				console.log(`Detected that my task started with pid ${e.processId}`);
			}
		});

		vscode.tasks.onDidEndTaskProcess(e => {
			if (e.execution === echoTaskExecution) {
				console.log(`Detected that my task exited with exit code ${e.exitCode}`);
			} else if (e.execution.task === echoTask) {
				console.log(`Detected that my task exited with exit code ${e.exitCode}`);
			}
		});
	});
  1. Run debug the extension and run the 'Hello World' command.

If you break inside the onDidStartTaskProcess and onDidEndTaskProcess that comparison fail, which means its difficult to determine when the task starts or ends.

It's worth noting that in VSCode 1.43 the above comparisons both work, but in 1.44 this is not working.

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

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bugtasksTask system issues

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions