Skip to content

Commit f17453c

Browse files
authored
UserInteraction: don't loop when reaching the input end. (#1870)
1 parent 988dbf6 commit f17453c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/BenchmarkDotNet/Running/UserInteraction.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@ public IReadOnlyList<Type> AskUser([NotNull] IReadOnlyList<Type> allTypes, ILogg
4040
logger.WriteLineHelp("If you want to select few, please separate them with space ` ` (e.g. `1 2 3`).");
4141
logger.WriteLineHelp($"You can also provide the class name in console arguments by using --filter. (e.g. `{filterExample}`).");
4242

43-
string userInput = Console.ReadLine() ?? "";
43+
string userInput = Console.ReadLine();
44+
if (userInput == null)
45+
{
46+
break;
47+
}
4448

4549
selectedTypes.AddRange(GetMatching(allTypes, userInput.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)));
4650
logger.WriteLine();

0 commit comments

Comments
 (0)