Interface TerminalShellExecutionEndEvent

An event signalling that an execution has ended in a terminal.

Stubbed

interface TerminalShellExecutionEndEvent {
    execution: TerminalShellExecution;
    exitCode: undefined | number;
    shellIntegration: TerminalShellIntegration;
    terminal: Terminal;
}

Properties

The terminal shell execution that has ended.

Stubbed

exitCode: undefined | number

The exit code reported by the shell.

Note that undefined means the shell either did not report an exit code (ie. the shell integration script is misbehaving) or the shell reported a command started before the command finished (eg. a sub-shell was opened). Generally this should not happen, depending on the use case, it may be best to treat this as a failure.

Example

const execution = shellIntegration.executeCommand({
command: 'echo',
args: ['Hello world']
});
window.onDidEndTerminalShellExecution(event => {
if (event.execution === execution) {
if (event.exitCode === undefined) {
console.log('Command finished but exit code is unknown');
} else if (event.exitCode === 0) {
console.log('Command succeeded');
} else {
console.log('Command failed');
}
}
});

Stubbed

shellIntegration: TerminalShellIntegration

The shell integration object.

Stubbed

terminal: Terminal

The terminal that shell integration has been activated in.

Stubbed