vscode icon indicating copy to clipboard operation
vscode copied to clipboard

Test: gracefully killing terminal processes

Open meganrogge opened this issue 7 months ago • 0 comments

Refs #206607

  • [ ] Windows
  • [ ] macOS
  • [ ] Linux

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:

  • Open https://github.com/xtermjs/xterm.js
  • Run npm i in the terminal
  • ctrlCmd+shift+b to start the default build task.
  • It launches the demo using a port.

meganrogge avatar May 23 '25 20:05 meganrogge