MCPcopy
hub / github.com/microsoft/vscode / waitForServer

Function waitForServer

test/unit/electron/index.js:350–375  ·  view source on GitHub ↗
(port)

Source from the content-addressed store, hash-verified

348 });
349
350 async function waitForServer(port) {
351 let timeout;
352 let socket;
353
354 return new Promise(resolve => {
355 socket = net.connect(port, '127.0.0.1');
356 socket.on('error', e => {
357 console.error('error connecting to waitServer', e);
358 resolve(undefined);
359 });
360
361 socket.on('close', () => {
362 resolve(undefined);
363 });
364
365 timeout = setTimeout(() => {
366 console.error('timed out waiting for before starting tests debugger');
367 resolve(undefined);
368 }, 15000);
369 }).finally(() => {
370 if (socket) {
371 socket.end();
372 }
373 clearTimeout(timeout);
374 });
375 }
376
377 function sendRun() {
378 win.webContents.send('run', args);

Callers 1

index.jsFile · 0.70

Calls 8

connectMethod · 0.65
onMethod · 0.65
errorMethod · 0.65
endMethod · 0.65
resolveFunction · 0.50
setTimeoutFunction · 0.50
clearTimeoutFunction · 0.50
finallyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…