Smoke test runner fails or hangs without error (fix #141148)

This commit is contained in:
Benjamin Pasero
2022-01-22 08:43:21 +01:00
parent 1bf726b8b1
commit b7cdfce7e5
2 changed files with 23 additions and 5 deletions
+22 -4
View File
@@ -253,7 +253,7 @@ async function launchServer(options: LaunchOptions) {
return {
serverProcess,
endpoint: await measureAndLog(waitForEndpoint(serverProcess), 'waitForEndpoint(serverProcess)', logger)
endpoint: await measureAndLog(waitForEndpoint(serverProcess, logger), 'waitForEndpoint(serverProcess)', logger)
};
}
@@ -314,13 +314,31 @@ async function teardown(server: ChildProcess, logger: Logger): Promise<void> {
logger.log(`Gave up tearing down server after ${retries} attempts...`);
}
function waitForEndpoint(server: ChildProcess): Promise<string> {
function waitForEndpoint(server: ChildProcess, logger: Logger): Promise<string> {
return new Promise<string>((resolve, reject) => {
server.stdout?.on('data', (d: Buffer) => {
const matches = d.toString('ascii').match(/Web UI available at (.+)/);
let endpointFound = false;
server.stdout?.on('data', data => {
if (!endpointFound) {
logger.log(`[server] stdout: ${data}`); // log until endpoint found to diagnose issues
}
const matches = data.toString('ascii').match(/Web UI available at (.+)/);
if (matches !== null) {
endpointFound = true;
resolve(matches[1]);
}
});
server.stderr?.on('data', error => {
if (!endpointFound) {
logger.log(`[server] stderr: ${error}`); // log until endpoint found to diagnose issues
}
if (error.toString().indexOf('EADDRINUSE') !== -1) {
reject(new Error(error));
}
});
});
}
+1 -1
View File
@@ -180,7 +180,7 @@ if (!opts.web) {
}
if (!fs.existsSync(electronPath || '')) {
fail(`Can't find VSCode at ${electronPath}.`);
fail(`Can't find VSCode at ${electronPath}. Please run VSCode once first (scripts/code.sh, scripts\\code.bat) and try again.`);
}
if (process.env.VSCODE_DEV === '1') {