Add Terminal.processId example

Part of Microsoft/vscode#11919
This commit is contained in:
Daniel Imms
2016-09-19 14:35:52 -07:00
parent 5a22cc9581
commit e6bac737f5
3 changed files with 18 additions and 3 deletions

View File

@ -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];