aboutsummaryrefslogtreecommitdiff
path: root/contrib/epee
diff options
context:
space:
mode:
authorJethro Grassie <jtg@xtrabass.com>2017-06-22 08:15:18 -0400
committerJethro Grassie <jtg@xtrabass.com>2017-06-25 10:48:02 -0400
commitbe9d4f041117da7afa610328f13b7bfddadd12c8 (patch)
treedb8d6c9921a161fc692e13e6a9341c72b0f1a089 /contrib/epee
parentMerge pull request #2111 (diff)
downloadmonero-be9d4f041117da7afa610328f13b7bfddadd12c8.tar.xz
Fix multiline wallet cli output with readline
monero-wallet-cli commands which have multine output sometimes causes issues with the readline support. This patch fixes show_transfers, payments and incoming_transfers.
Diffstat (limited to 'contrib/epee')
-rw-r--r--contrib/epee/src/readline_buffer.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/contrib/epee/src/readline_buffer.cpp b/contrib/epee/src/readline_buffer.cpp
index 2d17103b3..3865b565c 100644
--- a/contrib/epee/src/readline_buffer.cpp
+++ b/contrib/epee/src/readline_buffer.cpp
@@ -12,7 +12,7 @@ static void remove_line_handler();
static std::string last_line;
static std::string last_prompt;
-std::mutex line_mutex, sync_mutex;
+std::mutex line_mutex, sync_mutex, process_mutex;
std::condition_variable have_line;
namespace
@@ -21,6 +21,7 @@ namespace
}
rdln::suspend_readline::suspend_readline()
+: m_buffer(NULL), m_restart(false)
{
m_buffer = current;
if(!m_buffer)
@@ -46,6 +47,7 @@ rdln::readline_buffer::readline_buffer()
void rdln::readline_buffer::start()
{
+ std::unique_lock<std::mutex> lock(process_mutex);
if(m_cout_buf != NULL)
return;
m_cout_buf = std::cout.rdbuf();
@@ -55,6 +57,7 @@ void rdln::readline_buffer::start()
void rdln::readline_buffer::stop()
{
+ std::unique_lock<std::mutex> lock(process_mutex);
if(m_cout_buf == NULL)
return;
std::cout.rdbuf(m_cout_buf);
@@ -80,6 +83,7 @@ void rdln::readline_buffer::set_prompt(const std::string& prompt)
int rdln::readline_buffer::process()
{
+ std::unique_lock<std::mutex> lock(process_mutex);
if(m_cout_buf == NULL)
return 0;
return process_input();