Skip to content

Commit 6f99810

Browse files
committed
Use void | number for onDidClose
Fixes microsoft#79643
1 parent 8ecc032 commit 6f99810

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

src/vs/vscode.proposed.d.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -881,6 +881,11 @@ declare module 'vscode' {
881881
/**
882882
* An event that when fired will signal that the pty is closed and dispose of the terminal.
883883
*
884+
* A number can be used to provide an exit code for the terminal. Exit codes must be
885+
* positive and a non-zero exit codes signals failure which shows a notification for a
886+
* regular terminal and allows dependent tasks to proceed when used with the
887+
* `CustomExecution2` API.
888+
*
884889
* **Example:** Exit the terminal when "y" is pressed, otherwise show a notification.
885890
* ```typescript
886891
* const writeEmitter = new vscode.EventEmitter<string>();
@@ -899,7 +904,7 @@ declare module 'vscode' {
899904
* };
900905
* vscode.window.createTerminal({ name: 'Exit example', pty });
901906
*/
902-
onDidClose?: Event<void>;
907+
onDidClose?: Event<void | number>;
903908

904909
/**
905910
* Implement to handle when the pty is open and ready to start firing events.

src/vs/workbench/api/node/extHostTerminalService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@ class ExtHostPseudoterminal implements ITerminalChildProcess {
738738
// Attach the listeners
739739
this._pty.onDidWrite(e => this._onProcessData.fire(e));
740740
if (this._pty.onDidClose) {
741-
this._pty.onDidClose(e => this._onProcessExit.fire(0));
741+
this._pty.onDidClose(e => this._onProcessExit.fire(e || 0));
742742
}
743743
if (this._pty.onDidOverrideDimensions) {
744744
this._pty.onDidOverrideDimensions(e => this._onProcessOverrideDimensions.fire(e ? { cols: e.columns, rows: e.rows } : e));

0 commit comments

Comments
 (0)