Search code examples
terminalvscode-extensionscpu-architectureamd-processorubuntu-22.04

VSCode Extension that Executes terminal command


Trying to write an extension that executes the terminal command.

For example: if I execute the sensors command in the terminal, it will show the CPU temperature. I want to create a command that prints this information into the terminal upon activation.

I have tried by placing it with registercommand like following.

let d = vscode.commands.registerCommand(sensors);
context.subscriptions.push(d);

Does anyone know where to put these type of terminal commands?

Environment: Ubuntu 22.04.1 LTS

AMD Ryzen 3


Solution

  • One possible approach is to use Node.js' child_process module, run the sensor command in a separate process with this, read the output and print that in an output channel in VS Code.