Skip to content

Commit 552e6fe

Browse files
authored
debug: potential fix for unit test flake (microsoft#156177)
Fixes microsoft#155801
1 parent 361215a commit 552e6fe

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/vs/workbench/contrib/debug/test/node/streamDebugAdapter.test.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,13 @@ suite('Debug - StreamDebugAdapter', () => {
4949

5050
const pipeName = crypto.randomBytes(10).toString('hex');
5151
const pipePath = platform.isWindows ? join('\\\\.\\pipe\\', pipeName) : join(tmpdir(), pipeName);
52-
const server = net.createServer(serverConnection).listen(pipePath);
52+
const server = await new Promise<net.Server>((resolve, reject) => {
53+
const server = net.createServer(serverConnection);
54+
server.once('listening', () => resolve(server));
55+
server.once('error', reject);
56+
server.listen(pipePath);
57+
});
58+
5359
const debugAdapter = new NamedPipeDebugAdapter({
5460
type: 'pipeServer',
5561
path: pipePath

0 commit comments

Comments
 (0)