From d4e7fcc2a8b36e7bf1450edeb67bb468aac8d602 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Sat, 20 Mar 2021 05:06:32 +0200 Subject: [PATCH] qt, rpc: Accept stop RPC even another command is executing --- src/qt/rpcconsole.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 96ee8968710..242d6c3b5f9 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -897,7 +897,7 @@ void RPCConsole::setMempoolSize(long numberOfTxs, size_t dynUsage) void RPCConsole::on_lineEdit_returnPressed() { - QString cmd = ui->lineEdit->text(); + QString cmd = ui->lineEdit->text().trimmed(); if (cmd.isEmpty()) { return; @@ -915,6 +915,13 @@ void RPCConsole::on_lineEdit_returnPressed() return; } + // A special case allows to request shutdown even a long-running command is executed. + if (cmd == QLatin1String("stop")) { + std::string dummy; + RPCExecuteCommandLine(m_node, dummy, cmd.toStdString()); + return; + } + ui->lineEdit->clear(); #ifdef ENABLE_WALLET