mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-14 03:58:33 -05:00
Merge VS Code 1.31.1 (#4283)
This commit is contained in:
@@ -7,7 +7,7 @@ import * as path from 'path';
|
||||
import * as cp from 'child_process';
|
||||
import * as os from 'os';
|
||||
import { tmpName } from 'tmp';
|
||||
import { IDriver, connect as connectDriver, IDisposable, IElement } from './driver';
|
||||
import { IDriver, connect as connectDriver, IDisposable, IElement, Thenable } from './driver';
|
||||
import { Logger } from '../logger';
|
||||
|
||||
const repoPath = path.join(__dirname, '../../../..');
|
||||
@@ -64,7 +64,7 @@ async function connect(child: cp.ChildProcess, outPath: string, handlePath: stri
|
||||
while (true) {
|
||||
try {
|
||||
const { client, driver } = await connectDriver(outPath, handlePath);
|
||||
return new Code(child, client, driver, logger);
|
||||
return new Code(client, driver, logger);
|
||||
} catch (err) {
|
||||
if (++errCount > 50) {
|
||||
child.kill();
|
||||
@@ -147,7 +147,7 @@ export async function spawn(options: SpawnOptions): Promise<Code> {
|
||||
}
|
||||
|
||||
async function poll<T>(
|
||||
fn: () => Promise<T>,
|
||||
fn: () => Thenable<T>,
|
||||
acceptFn: (result: T) => boolean,
|
||||
timeoutMessage: string,
|
||||
retryCount: number = 200,
|
||||
@@ -188,7 +188,6 @@ export class Code {
|
||||
private driver: IDriver;
|
||||
|
||||
constructor(
|
||||
private process: cp.ChildProcess,
|
||||
private client: IDisposable,
|
||||
driver: IDriver,
|
||||
readonly logger: Logger
|
||||
@@ -232,9 +231,13 @@ export class Code {
|
||||
await this.driver.reloadWindow(windowId);
|
||||
}
|
||||
|
||||
async exit(): Promise<void> {
|
||||
await this.driver.exitApplication();
|
||||
}
|
||||
|
||||
async waitForTextContent(selector: string, textContent?: string, accept?: (result: string) => boolean): Promise<string> {
|
||||
const windowId = await this.getActiveWindowId();
|
||||
accept = accept || (result => textContent !== void 0 ? textContent === result : !!result);
|
||||
accept = accept || (result => textContent !== undefined ? textContent === result : !!result);
|
||||
|
||||
return await poll(
|
||||
() => this.driver.getElements(windowId, selector).then(els => els.length > 0 ? Promise.resolve(els[0].textContent) : Promise.reject(new Error('Element not found for textContent'))),
|
||||
@@ -304,7 +307,6 @@ export class Code {
|
||||
|
||||
dispose(): void {
|
||||
this.client.dispose();
|
||||
this.process.kill();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user