From aab8a3af0f4052a760cd0943d59afef001e4eaa4 Mon Sep 17 00:00:00 2001 From: Lefteris Karapetsas Date: Tue, 2 Jun 2015 17:30:46 +0200 Subject: [PATCH] Clarify usage of silence in eth/main Making it global since it's a local variable used in a global way due to being captured by an exported lamda function. --- eth/main.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/eth/main.cpp b/eth/main.cpp index 095540a1c..2ab8e5ffb 100644 --- a/eth/main.cpp +++ b/eth/main.cpp @@ -66,6 +66,8 @@ using namespace dev::eth; using namespace boost::algorithm; using dev::eth::Instruction; +static bool g_silence = false; + void interactiveHelp() { cout @@ -595,21 +597,20 @@ int main(int argc, char** argv) clientName += "/"; string logbuf; - bool silence = false; std::string additional; g_logPost = [&](std::string const& a, char const*){ - if (silence) + if (g_silence) logbuf += a + "\n"; else cout << "\r \r" << a << endl << additional << flush; }; auto getPassword = [&](string const& prompt){ - auto s = silence; - silence = true; + auto s = g_silence; + g_silence = true; cout << endl; string ret = dev::getPassword(prompt); - silence = s; + g_silence = s; return ret; }; auto getAccountPassword = [&](Address const& a){ @@ -774,11 +775,11 @@ int main(int argc, char** argv) string l; while (!g_exit) { - silence = false; + g_silence = false; cout << logbuf << "Press Enter" << flush; std::getline(cin, l); logbuf.clear(); - silence = true; + g_silence = true; #if ETH_READLINE if (l.size())