Skip to content

Commit

Permalink
qt, rpc: Accept stop RPC even another command is executing
Browse files Browse the repository at this point in the history
While here, clean up the command input by calling the trimmed function
on the input from the command prompt.
  • Loading branch information
hebasto committed May 31, 2021
1 parent ccf7902 commit 0c32b9c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/qt/rpcconsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,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;
Expand All @@ -942,6 +942,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
Expand Down

0 comments on commit 0c32b9c

Please sign in to comment.