From ee53edc935e0a75a88972feb6b8490755cfa2224 Mon Sep 17 00:00:00 2001 From: Eroen Date: Thu, 26 Sep 2019 16:39:37 +0200 Subject: [PATCH] Allow reading passwords from redirected input This is beneficial for scripts that don't want to expose the password in the command line arguments. --- DepotDownloader/Program.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/DepotDownloader/Program.cs b/DepotDownloader/Program.cs index 71496a3d..f67c99a9 100644 --- a/DepotDownloader/Program.cs +++ b/DepotDownloader/Program.cs @@ -159,7 +159,15 @@ namespace DepotDownloader do { Console.Write( "Enter account password for \"{0}\": ", username ); - password = Util.ReadPassword(); + if ( Console.IsInputRedirected ) + { + password = Console.ReadLine(); + } + else + { + // Avoid console echoing of password + password = Util.ReadPassword(); + } Console.WriteLine(); } while ( String.Empty == password ); }