Skip to content

Commit

Permalink
Make Terminal.exitStatus stable API
Browse files Browse the repository at this point in the history
Fixes #62103
  • Loading branch information
Tyriar committed Feb 11, 2020
1 parent 997e4ea commit 26510e7
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 32 deletions.
29 changes: 29 additions & 0 deletions src/vs/vscode.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4930,6 +4930,21 @@ declare module 'vscode' {
*/
readonly creationOptions: Readonly<TerminalOptions | ExtensionTerminalOptions>;

/**
* The exit status of the terminal, this will be undefined while the terminal is active.
*
* **Example:** Show a notification with the exit code when the terminal exits with a
* non-zero exit code.
* ```typescript
* window.onDidCloseTerminal(t => {
* if (t.exitStatus && t.exitStatus.code) {
* vscode.window.showInformationMessage(`Exit code: ${t.exitStatus.code}`);
* }
* });
* ```
*/
readonly exitStatus: TerminalExitStatus | undefined;

/**
* Send text to the terminal. The text is written to the stdin of the underlying pty process
* (shell) of the terminal.
Expand Down Expand Up @@ -7746,6 +7761,20 @@ declare module 'vscode' {
readonly rows: number;
}

/**
* Represents how a terminal exited.
*/
export interface TerminalExitStatus {
/**
* The exit code that a terminal exited with, it can have the following values:
* - Zero: the terminal process or custom execution succeeded.
* - Non-zero: the terminal process or custom execution failed.
* - `undefined`: the user forcibly closed the terminal or a custom execution exited
* without providing an exit code.
*/
readonly code: number | undefined;
}

/**
* A location in the editor at which progress information can be shown. It depends on the
* location how progress is visually represented.
Expand Down
32 changes: 0 additions & 32 deletions src/vs/vscode.proposed.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1025,38 +1025,6 @@ declare module 'vscode' {

//#endregion

//#region Terminal exit status https://github.com/microsoft/vscode/issues/62103

export interface TerminalExitStatus {
/**
* The exit code that a terminal exited with, it can have the following values:
* - Zero: the terminal process or custom execution succeeded.
* - Non-zero: the terminal process or custom execution failed.
* - `undefined`: the user forcibly closed the terminal or a custom execution exited
* without providing an exit code.
*/
readonly code: number | undefined;
}

export interface Terminal {
/**
* The exit status of the terminal, this will be undefined while the terminal is active.
*
* **Example:** Show a notification with the exit code when the terminal exits with a
* non-zero exit code.
* ```typescript
* window.onDidCloseTerminal(t => {
* if (t.exitStatus && t.exitStatus.code) {
* vscode.window.showInformationMessage(`Exit code: ${t.exitStatus.code}`);
* }
* });
* ```
*/
readonly exitStatus: TerminalExitStatus | undefined;
}

//#endregion

//#region Terminal dimensions property and change event https://github.com/microsoft/vscode/issues/55718

/**
Expand Down

0 comments on commit 26510e7

Please sign in to comment.