microsoft / microsoft/vscode

vscode doesn't terminate the task process when closing the window

Open
#328,294 0 comments 0 reactions 1 assignee Claimed by @anthonykim1 View on GitHub
Dominant language
TypeScript
Stars
193k
Forks
42.4k
PR merge metrics
PR metrics pending

Description

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

- VS Code Version: 1.32.0-insider
- OS Version: Linux x64 6.12.96+deb13-amd64

For some reason, this bug occurs when I run PHP through Composer.
My task is very simple:
```jsonc
// tasks.json
{
"version": "2.0.0",
"tasks": [
{
"label": "reproduce bug",
"type": "shell",
"command": "composer run dev",
"problemMatcher": []
}
]
}
```

The composer dev script only contains this:
```jsonc
// composer.json
{
"scripts": {
"dev": "php -S localhost:8989"
},
"require": {}
}
```

When I close the window (by clicking the X button), the PHP process is still left running. This is strange because if I press Ctrl+C in the task, everything is terminated correctly. The same happens if I terminate the task from the UI, but if I close the VS Code window, it isn't.

It's quite annoying because every time I close VS Code and then open it again, I get an error saying that the port is already in use.

It's worth mentioning that this bug has never happened to me on Windows. It only started happening on Linux.

**Steps to Reproduce:**
Just copy and paste the tasks.json and composer.json above, run the task, and then close VS Code by clicking the X button. You'll notice that the PHP process keeps running.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.