Add createTerminal with options API with new option waitOnExit

Fixes #15583
This commit is contained in:
Daniel Imms
2017-01-09 10:56:46 -08:00
parent 1fafbd089d
commit 6bf0cde91e
7 changed files with 58 additions and 8 deletions

View File

@@ -20,14 +20,20 @@ export class ExtHostTerminal implements vscode.Terminal {
private _pidPromise: TPromise<number>;
private _pidPromiseComplete: TValueCallback<number>;
constructor(proxy: MainThreadTerminalServiceShape, name?: string, shellPath?: string, shellArgs?: string[]) {
constructor(
proxy: MainThreadTerminalServiceShape,
name?: string,
shellPath?: string,
shellArgs?: string[],
waitOnExit?: boolean
) {
this._name = name;
this._queuedRequests = [];
this._proxy = proxy;
this._pidPromise = new TPromise<number>(c => {
this._pidPromiseComplete = c;
});
this._proxy.$createTerminal(name, shellPath, shellArgs).then((id) => {
this._proxy.$createTerminal(name, shellPath, shellArgs, waitOnExit).then((id) => {
this._id = id;
this._queuedRequests.forEach((r) => {
r.run(this._proxy, this._id);
@@ -107,6 +113,12 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape {
return terminal;
}
public createTerminalFromOptions(options: vscode.TerminalOptions): vscode.Terminal {
let terminal = new ExtHostTerminal(this._proxy, options.name, options.shellPath, options.shellArgs, options.waitOnExit);
this._terminals.push(terminal);
return terminal;
}
public get onDidCloseTerminal(): Event<vscode.Terminal> {
return this._onDidCloseTerminal && this._onDidCloseTerminal.event;
}