Remove nop use of Console.OpenStandardInput (#49)

This commit is contained in:
Stephen Toub 2025-03-09 06:03:13 -04:00 • committed by GitHub
commit e187ebacc4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -105,8 +105,7 @@ public sealed class StdioServerTransport : TransportBase, IServerTransport
while (!cancellationToken.IsCancellationRequested) while (!cancellationToken.IsCancellationRequested)
{ {
_logger.TransportWaitingForMessage(EndpointName); _logger.TransportWaitingForMessage(EndpointName);
using (Console.OpenStandardInput())
{
var reader = Console.In; var reader = Console.In;
var line = await reader.ReadLineAsync(cancellationToken).ConfigureAwait(false); var line = await reader.ReadLineAsync(cancellationToken).ConfigureAwait(false);
if (line == null) if (line == null)
@ -147,7 +146,6 @@ public sealed class StdioServerTransport : TransportBase, IServerTransport
// Continue reading even if we fail to parse a message // Continue reading even if we fail to parse a message
} }
} }
}
_logger.TransportExitingReadMessagesLoop(EndpointName); _logger.TransportExitingReadMessagesLoop(EndpointName);
} }
catch (OperationCanceledException) catch (OperationCanceledException)