mirror of
https://github.com/microsoft/vscode-extension-samples.git
synced 2026-06-13 07:10:26 +08:00
@ -54,9 +54,16 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
context.subscriptions.push(vscode.commands.registerCommand('terminalTest.createZshLoginShell', () => {
|
||||
terminalStack.push((<any>vscode.window).createTerminal(`Ext Terminal #${terminalStack.length + 1}`, '/bin/zsh', ['-l']));
|
||||
}));
|
||||
(<any>vscode.window).onDidCloseTerminal((terminal) => {
|
||||
console.log('Terminal closed', terminal);
|
||||
});
|
||||
context.subscriptions.push(vscode.commands.registerCommand('terminalTest.processId', () => {
|
||||
(<any>getLatestTerminal()).processId.then((processId) => {
|
||||
console.log(`Shell process ID: ${processId}`);
|
||||
});
|
||||
}));
|
||||
if ('onDidCloseTerminal' in <any>vscode.window) {
|
||||
(<any>vscode.window).onDidCloseTerminal((terminal) => {
|
||||
console.log('Terminal closed', terminal);
|
||||
});
|
||||
}
|
||||
|
||||
function getLatestTerminal() {
|
||||
return terminalStack[terminalStack.length - 1];
|
||||
|
||||
Reference in New Issue
Block a user