From 7fddb77bfaca8a64f2cabbec710a766a7a1df3b7 Mon Sep 17 00:00:00 2001 From: Eduardo Villalpando Mello Date: Fri, 14 Mar 2025 08:38:05 -0700 Subject: [PATCH] Require enter on user input --- .../Shared/Commands/UninstallCommandExec.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/dotnet-core-uninstall/Shared/Commands/UninstallCommandExec.cs b/src/dotnet-core-uninstall/Shared/Commands/UninstallCommandExec.cs index 612e724d..5eddfffe 100644 --- a/src/dotnet-core-uninstall/Shared/Commands/UninstallCommandExec.cs +++ b/src/dotnet-core-uninstall/Shared/Commands/UninstallCommandExec.cs @@ -193,7 +193,7 @@ public static bool AskItAndReturnUserAnswer(IDictionary bundles, Console.Write(string.Format(RuntimeInfo.RunningOnWindows ? LocalizableStrings.WindowsConfirmationPromptOutputFormat : LocalizableStrings.MacConfirmationPromptOutputFormat, displayNames)); - var response = userResponse?.ToUpper() ?? Console.ReadKey().KeyChar.ToString().ToUpper(); + var response = (userResponse ?? Console.ReadLine()).ToUpper(); if (response.Equals("Y")) { @@ -216,13 +216,13 @@ public static bool AskWithWarningsForRequiredBundles(IDictionary LocalizableStrings.MacRequiredBundleConfirmationPromptOutputFormat, pair.Key.DisplayName, pair.Value)); Console.ResetColor(); - var response = userResponse?.ToUpper() ?? Console.ReadKey().KeyChar.ToString().ToUpper(); + var response = (userResponse ?? Console.ReadLine()).ToUpper(); if (response.Equals("N")) { return false; } - if (!(response.Equals("Y") || response.Equals("YES"))) + if (!response.Equals("Y")) { throw new ConfirmationPromptInvalidException(); }