Repository: vscode
Issue: The exitCode in onDidEndTaskProcess event callback is 0 when user hits Ctrl-C on the task.
Labels: bug,confirmed,terminal-process

<!-- ⚠️⚠️ Do Not Delete This! bug_report_template ⚠️⚠️ -->
<!-- Please read our Rules of Conduct: https://opensource.microsoft.com/codeofconduct/ -->
<!-- 🕮 Read our guide about submitting issues: https://github.com/microsoft/vscode/wiki/Submitting-Bugs-and-Suggestions -->
<!-- 🔎 Search existing issues to avoid creating duplicates. -->
<!-- 🧪 Test using the latest Insiders build to see if your issue has already been fixed: https://code.visualstudio.com/insiders/ -->
<!-- 💡 Instead of creating your report here, use 'Report Issue' from the 'Help' menu in VS Code to pre-fill useful information. -->
<!-- 🔧 Launch with `code --disable-extensions` to check. -->
Does this issue occur when all extensions are disabled?: n/a

<!-- 🪓 If you answered No above, use 'Help: Start Extension Bisect' from Command Palette to try to identify the cause. -->
<!-- 📣 Issues caused by an extension need to be reported directly to the extension publisher. The 'Help > Report Issue' dialog can assist with this. -->
- VS Code Version:
```
code --version
1.56.2
054a9295330880ed74ceaedda236253b4f39a335
x64
```
- OS Version:
```
uname -a
Linux alex-p330 5.8.0-53-generic #60~20.04.1-Ubuntu SMP Thu May 6 09:52:46 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
```
The exitCode in onDidEndTaskProcess event callback return 0 when user hits Ctrl-C on the task. I expect it to be a non-zero value

#### Steps to Reproduce

1. Write a [simple extension](https://github.com/a1exwang/vscode-extension-samples/blob/main/task-provider-sample/src/extension.ts) based on vscode examples.

attach the code here for your convenience.

```typescript
import * as vscode from 'vscode';

export class SimpleTaskProvider implements vscode.TaskProvider {
	static TaskType = 'simple task';
	public provideTasks(): Thenable<vscode.Task[]> | undefined {
		return Promise.resolve([
			new vscode.Task(
				{type: SimpleTaskProvider.TaskType},
				 vscode.TaskScope.Workspace,
				"sleep",
				SimpleTaskProvider.TaskType,
				new vscode.ShellExecution("echo 'start to sleep' && sleep 10000000"))
		]);
	}

	public resolveTask(task: vscode.Task): vscode.Task | undefined {
		return undefined;
	}
}

export function activate(_context: vscode.ExtensionContext): void {
	vscode.tasks.registerTaskProvider(SimpleTaskProvider.TaskType, new SimpleTaskProvider());
	_context.subscriptions.push(vscode.tasks.onDidEndTaskProcess(onDidEndTaskProcessHandler));
}

function onDidEndTaskProcessHandler(event: vscode.TaskProcessEndEvent): void {
	console.log(`task '${event.execution.task.name}' ends, exit code = '${event.exitCode}'`);
}
```

2. Debug the extension using vscode and from the newly launched vscode instance, open command pallete, select `Tasks: Run Task`, and select `simple task` and then select `simple task: sleep` and then select `Continue without scanning the task output`.
3. When the task is launched in the Terminal, it will say
![image](https://user-images.githubusercontent.com/9698542/121324447-51f5ff00-c943-11eb-9877-d010a9b995d6.png)

Now click Ctrl-C to stop the task.

4. Check "DEBUG CONSOLE" in the extension debug vscode instance to see the console output, it will say "exit code = '0'", meaning the exit code is 0 for this task.
![image](https://user-images.githubusercontent.com/9698542/121324689-89fd4200-c943-11eb-8226-036e6bccfe3f.png)

#### Expected Result
I expect exit code to be something other than 0, because the command does not run successfully.

For example, by testing this exact command in bash, you can see the exit code is 130 in bash after hitting Ctrl-C. This is what I expect

```
alexwang@alex-p330:~$ echo 'start to sleep' && sleep 10000000000
start to sleep
^C
alexwang@alex-p330:~$ echo $?
130
alexwang@alex-p330:~$ 
```