Repository: vscode
Issue: Killing Tasks with the Trash Can Icon does not Kill Underlying Processes
Labels: bug,confirmation-pending,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. -->

## Description

I was helping a co-worker with their VS Code setup and realized that when they kill "tasks" via the trash can icon, the underlying process does not exit.
My other co-worker was also able to reproduce this issue on a similar machine (latest stable VS Code on latest stable macOS aarch64).

What I believe is happening is that using the trash can icon to kill the task deletes the "task" but not the backgrounded process. It's also worth noting that the process was not intentionally backgrounded. The process is the execution of `make` target that runs `cargo` run.

> It could also be possible that our [axum](https://github.com/tokio-rs/axum)-backed Rust program does not accept a signal (i.e. `SIGINT`, `SIGTERM`, `SIGKILL`) that VS Code Tasks requires to end processes when clicking the trash can icon.

### Disclaimer on Reproduction Steps

These reproduction steps are purely reflecting how we ran into the issue.
We are unsure if it is specific to our [axum](https://github.com/tokio-rs/axum)-backed Rust program, so it may be possible to reproduce this with another task configuration.

## Required Information

Does this issue occur when all extensions are disabled?: Yes

<!-- 🪓 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: `1.71.0 (Universal)` and `1.71.0 (native aarch64)`
- OS Version: `Darwin arm64 21.6.0`

```
Version: 1.71.0 (Universal)
Commit: 784b0177c56c607789f9638da7b6bf3230d47a8c
Date: 2022-09-01T07:25:38.437Z
Electron: 19.0.12
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Darwin arm64 21.6.0
Sandboxed: No
```

Steps to Reproduce:

1. Have an environment matching the above (might happen with other configurations though)
2. Have the latest [`cargo`](https://doc.rust-lang.org/cargo/) installed an in `PATH`
3. Ensure `make` from `/usr/bin/make` (default on macOS) is in `PATH` (should be already, but it might be good to double check that GNU Make is not used instead)
4. Clone the `axum` repository and open VS Code in an example crate within the `examples` directory: https://github.com/tokio-rs/axum/tree/main/examples
5. Open a Rust Create a `make` target in the following shape:

```make
do-cargo-run:
    cargo run
```

6. Create a VS Code Task with the following shape:

```json
{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "make do-cargo-run",
            "type": "shell",
            "command": "make do-cargo-run",
            "problemMatcher": [],
            "presentation": {
                "group": "foo"
            }
        }
    ]
}
```

7. Run the VS Code Task
8. Close with trash can icon button on the right hand side the UI
9. Observed that the Task was deleted
10. (Optional) Fully close VS Code
11. Run `ps` in a terminal and observe that the process is still running (`make` running `cargo run`)