Skip to content

Commit

Permalink
Ensure failures to connect to the named pipe are propogated
Browse files Browse the repository at this point in the history
  • Loading branch information
dibarbet committed Feb 13, 2024
1 parent 6ac1a6d commit 0b6a1bc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/lsptoolshost/roslynLanguageServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -629,12 +629,15 @@ export class RoslynLanguageServer {
throw new Error('Timeout. Named pipe information not received from server.');
}

const socketPromise = new Promise<net.Socket>((resolve) => {
const socketPromise = new Promise<net.Socket>((resolve, reject) => {
_channel.appendLine('attempting to connect client to server...');
const socket = net.createConnection(pipeConnectionInfo.pipeName, () => {
_channel.appendLine('client has connected to server');
resolve(socket);
});

// If we failed to connect for any reason, ensure the error is propagated.
socket.on('error', (err) => reject(err));
});

// Wait for the client to connect to the named pipe.
Expand Down

0 comments on commit 0b6a1bc

Please sign in to comment.