Skip to content

Commit

Permalink
Read passwords from redirected input
Browse files Browse the repository at this point in the history
Add a fallback to allow reading passwords from redirected input.  This is
beneficial for scripts that don't want to expose the password in the command
line arguments.
  • Loading branch information
eroen committed Sep 29, 2019
1 parent ffcde1b commit 4cf275d
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions DepotDownloader/Program.cs
Expand Up @@ -159,8 +159,17 @@ static bool InitializeSteam( string username, string password )
do
{
Console.Write( "Enter account password for \"{0}\": ", username );
password = Util.ReadPassword();
Console.WriteLine();
// Avoid console echoing of password
try
{
password = Util.ReadPassword();
Console.WriteLine();
}
// Fallback to support redirected input
catch ( System.InvalidOperationException )
{
password = Console.ReadLine();
}
} while ( String.Empty == password );
}
else if ( username == null )
Expand Down

0 comments on commit 4cf275d

Please sign in to comment.