Skip to content

Commit 0c32b9c

Browse files
committed
qt, rpc: Accept stop RPC even another command is executing
While here, clean up the command input by calling the trimmed function on the input from the command prompt.
1 parent ccf7902 commit 0c32b9c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/qt/rpcconsole.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,7 @@ void RPCConsole::setMempoolSize(long numberOfTxs, size_t dynUsage)
924924

925925
void RPCConsole::on_lineEdit_returnPressed()
926926
{
927-
QString cmd = ui->lineEdit->text();
927+
QString cmd = ui->lineEdit->text().trimmed();
928928

929929
if (cmd.isEmpty()) {
930930
return;
@@ -942,6 +942,13 @@ void RPCConsole::on_lineEdit_returnPressed()
942942
return;
943943
}
944944

945+
// A special case allows to request shutdown even a long-running command is executed.
946+
if (cmd == QLatin1String("stop")) {
947+
std::string dummy;
948+
RPCExecuteCommandLine(m_node, dummy, cmd.toStdString());
949+
return;
950+
}
951+
945952
ui->lineEdit->clear();
946953

947954
#ifdef ENABLE_WALLET

0 commit comments

Comments
 (0)