Skip to content

Commit 26510e7

Browse files
committed
Make Terminal.exitStatus stable API
Fixes microsoft#62103
1 parent 997e4ea commit 26510e7

2 files changed

Lines changed: 29 additions & 32 deletions

File tree

src/vs/vscode.d.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4930,6 +4930,21 @@ declare module 'vscode' {
49304930
*/
49314931
readonly creationOptions: Readonly<TerminalOptions | ExtensionTerminalOptions>;
49324932

4933+
/**
4934+
* The exit status of the terminal, this will be undefined while the terminal is active.
4935+
*
4936+
* **Example:** Show a notification with the exit code when the terminal exits with a
4937+
* non-zero exit code.
4938+
* ```typescript
4939+
* window.onDidCloseTerminal(t => {
4940+
* if (t.exitStatus && t.exitStatus.code) {
4941+
* vscode.window.showInformationMessage(`Exit code: ${t.exitStatus.code}`);
4942+
* }
4943+
* });
4944+
* ```
4945+
*/
4946+
readonly exitStatus: TerminalExitStatus | undefined;
4947+
49334948
/**
49344949
* Send text to the terminal. The text is written to the stdin of the underlying pty process
49354950
* (shell) of the terminal.
@@ -7746,6 +7761,20 @@ declare module 'vscode' {
77467761
readonly rows: number;
77477762
}
77487763

7764+
/**
7765+
* Represents how a terminal exited.
7766+
*/
7767+
export interface TerminalExitStatus {
7768+
/**
7769+
* The exit code that a terminal exited with, it can have the following values:
7770+
* - Zero: the terminal process or custom execution succeeded.
7771+
* - Non-zero: the terminal process or custom execution failed.
7772+
* - `undefined`: the user forcibly closed the terminal or a custom execution exited
7773+
* without providing an exit code.
7774+
*/
7775+
readonly code: number | undefined;
7776+
}
7777+
77497778
/**
77507779
* A location in the editor at which progress information can be shown. It depends on the
77517780
* location how progress is visually represented.

src/vs/vscode.proposed.d.ts

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,38 +1025,6 @@ declare module 'vscode' {
10251025

10261026
//#endregion
10271027

1028-
//#region Terminal exit status https://github.com/microsoft/vscode/issues/62103
1029-
1030-
export interface TerminalExitStatus {
1031-
/**
1032-
* The exit code that a terminal exited with, it can have the following values:
1033-
* - Zero: the terminal process or custom execution succeeded.
1034-
* - Non-zero: the terminal process or custom execution failed.
1035-
* - `undefined`: the user forcibly closed the terminal or a custom execution exited
1036-
* without providing an exit code.
1037-
*/
1038-
readonly code: number | undefined;
1039-
}
1040-
1041-
export interface Terminal {
1042-
/**
1043-
* The exit status of the terminal, this will be undefined while the terminal is active.
1044-
*
1045-
* **Example:** Show a notification with the exit code when the terminal exits with a
1046-
* non-zero exit code.
1047-
* ```typescript
1048-
* window.onDidCloseTerminal(t => {
1049-
* if (t.exitStatus && t.exitStatus.code) {
1050-
* vscode.window.showInformationMessage(`Exit code: ${t.exitStatus.code}`);
1051-
* }
1052-
* });
1053-
* ```
1054-
*/
1055-
readonly exitStatus: TerminalExitStatus | undefined;
1056-
}
1057-
1058-
//#endregion
1059-
10601028
//#region Terminal dimensions property and change event https://github.com/microsoft/vscode/issues/55718
10611029

10621030
/**

0 commit comments

Comments
 (0)