Skip to content

Commit

Permalink
Outputing newline after password prompt. (#659)
Browse files Browse the repository at this point in the history
  • Loading branch information
louib authored Jun 22, 2017
1 parent 95baf25 commit fdbed32
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/cli/PasswordInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,15 @@ void PasswordInput::setStdinEcho(bool enable = true)
QString PasswordInput::getPassword()
{
static QTextStream inputTextStream(stdin, QIODevice::ReadOnly);
static QTextStream outputTextStream(stdout, QIODevice::WriteOnly);

setStdinEcho(false);
QString line = inputTextStream.readLine();
setStdinEcho(true);

// The new line was also not echoed, but we do want to echo it.
outputTextStream << "\n";
outputTextStream.flush();

return line;
}

0 comments on commit fdbed32

Please sign in to comment.