Skip to content

Commit 4fc7cb1

Browse files
Use a timeout when calling RequestShutdown()
1 parent 68680df commit 4fc7cb1

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/Client/LanguageClient.cs

+10-1
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,16 @@ public async Task Shutdown()
423423
{
424424
if (_connection.IsOpen)
425425
{
426-
await this.RequestShutdown().ConfigureAwait(false);
426+
try
427+
{
428+
// this can get stuck forever, so use a timeout.
429+
var cancelSource = new CancellationTokenSource();
430+
cancelSource.CancelAfter(5 * 1000);
431+
432+
await this.RequestShutdown(cancelSource.Token).ConfigureAwait(false);
433+
}
434+
catch (TaskCanceledException) { }
435+
427436
this.SendExit();
428437
}
429438

0 commit comments

Comments
 (0)