Fix IOStreamConsole::askPassword
This commit is contained in:
parent
804dc89fb7
commit
13f820975a
@ -1,6 +1,7 @@
|
|||||||
#include "IOStreamConsole.h"
|
#include "IOStreamConsole.h"
|
||||||
#include <boost/algorithm/string/trim.hpp>
|
#include <boost/algorithm/string/trim.hpp>
|
||||||
#include "DontEchoStdinToStdoutRAII.h"
|
#include "DontEchoStdinToStdoutRAII.h"
|
||||||
|
#include <cpp-utils/assert/assert.h>
|
||||||
|
|
||||||
using std::ostream;
|
using std::ostream;
|
||||||
using std::istream;
|
using std::istream;
|
||||||
@ -104,10 +105,7 @@ string IOStreamConsole::askPassword(const string &question) {
|
|||||||
std::getline(_input, result);
|
std::getline(_input, result);
|
||||||
_output << std::endl;
|
_output << std::endl;
|
||||||
|
|
||||||
//Remove trailing newline
|
ASSERT(result.size() == 0 || result[result.size() - 1] != '\n', "Unexpected std::getline() behavior");
|
||||||
if (result[result.size()-1] == '\n') {
|
|
||||||
result.resize(result.size()-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user