Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to read active terminal output in vscode extension? [duplicate]

I'd like to watch vscode builtin terminal output or at least be able to read whole output. This output will be searched against some pattern.

I looked at this question, but mentioned method

window.onDidWriteTerminalData

appears to be not available at current api.

How to read terminal output from vscode extension?

like image 386
krzyski Avatar asked Oct 21 '25 18:10

krzyski


1 Answers

It cannot do in stable version of VSCode. Try window.onDidWriteTerminalData API only in Insider version.

For your information, there are several options, not official supported by VSCode.

  1. Use node-pty to create and manage the process and then hook it up using ExtensionTerminalOptions.
  2. Create a process/script that wraps the terminal shell.

reference:

https://github.com/microsoft/vscode/issues/83224

https://github.com/microsoft/vscode/commit/dc6b475be75999e78233f9f6951ef66f18f768ea#r53974957

like image 166
HIGAKING Avatar answered Oct 24 '25 07:10

HIGAKING



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!