Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get exit code after running command in integrated terminal in vscode

After running terminal.sendtext("some command"), how do I get the exit code of the command? If this is not possible, is there a way to run the command in external terminal(using something likechild_process.spawnSync()) and get the exit code?

like image 339
Agile_Eagle Avatar asked Dec 01 '25 14:12

Agile_Eagle


1 Answers

You could use the new terminal exit api, see v1.71 Release Notes: terminal exit status api:

TerminalExitStatus.reason

Extension authors now have better insight into why a terminal exited via the new TerminalExitReason API.

export enum TerminalExitReason {
  Unknown = 0,
  Shutdown = 1,
  Process = 2,
  User = 3,
  Extension = 4,
}
like image 59
Mark Avatar answered Dec 04 '25 13:12

Mark



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!