Closed
Description
Refs #206607
- Windows @amunger
- macOS @aiday-mar
- Linux @rzhao271
Complexity: 4
We’ve added an opt-in setting, terminal.integrated.killGracefully
, to cleanly shut down terminal processes, including child processes. This helps avoid orphaned processes, frees up ports, and can reduce the risk of resource leaks.
- To begin, have that setting disabled
- Open a repo with a task or terminal command that uses a port (see example below)
- Run that task or command in the terminal
- Click the trash can to kill the terminal or close VS Code.
- Reopen that repo and rerun the command or task.
- You'll see an error about address in use.
- List all processes using that port (3000 or whatever yours is using):
lsof -i :3000
- Run
kill -9 PID
- Enable the setting.
- Repeat the above steps. You should not encounter an error - it should run successfully.
Example:
- clone https://github.com/tokio-rs/axum/
- see Test: gracefully killing terminal processes #249671 (comment)
- run the task
- kill the terminal with the trash can
- run the task again