Close serial terminal when uploading in VS Code


It would be awesome if the serial terminal were automatically closed when uploading a build. Currently my process looks something like:

  • watch some output on the serial monitor
  • make code changes
  • build
  • upload
  • upload fails, so I remember I left the serial monitor open
  • hunt for the serial monitor window to close it
  • re-upload

:slight_smile: It would be awesome if the middle steps could be skipped.


If you open serial monitor via Serial Monitor button on the bottom toolbar, PIO IDE should close it automatically.
Nevertheless, we depend on VSCode API from Microsoft


This doesn’t seem to work for me – I still have to manually close the serial monitor in VS Code when I upload new code.


If you use buttons on PIO Toolbar, all should work. I’ve just pressed “monitor” button, then “upload” and VSCode asked me to terminate existing task. This is a temporary workaround while VSCode does not have proper API to terminate particular task.