Outputing newline after password prompt. (#659)

This commit is contained in:
louib 2017-06-22 16:25:24 -04:00 committed by GitHub
parent 95baf25648
commit fdbed324f7

View File

@ -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;
}