Skip to content

Commit f25cfb6

Browse files
authored
Merge pull request #6881 from dibarbet/propogate_connection_errors
Ensure failures to connect to the named pipe are propogated
2 parents abddd41 + 0b6a1bc commit f25cfb6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/lsptoolshost/roslynLanguageServer.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,12 +629,15 @@ export class RoslynLanguageServer {
629629
throw new Error('Timeout. Named pipe information not received from server.');
630630
}
631631

632-
const socketPromise = new Promise<net.Socket>((resolve) => {
632+
const socketPromise = new Promise<net.Socket>((resolve, reject) => {
633633
_channel.appendLine('attempting to connect client to server...');
634634
const socket = net.createConnection(pipeConnectionInfo.pipeName, () => {
635635
_channel.appendLine('client has connected to server');
636636
resolve(socket);
637637
});
638+
639+
// If we failed to connect for any reason, ensure the error is propagated.
640+
socket.on('error', (err) => reject(err));
638641
});
639642

640643
// Wait for the client to connect to the named pipe.

0 commit comments

Comments
 (0)