Merge bitcoin/bitcoin#34224: init: Return EXIT_SUCCESS on interrupt
997e7b4d7cinit: Fix non-zero code on interrupt (sedited) Pull request description: Reported by dergoegge on irc. An interrupt does not create a failure exit code during normal operation. This should also be the case when interrupt is triggered during initialization. However a failure exit code is currently returned if an interrupt occurs during init. Fix this by making `AppInitMain` return true instead of false on interrupt, which further up the call stack currently sets the `EXIT_FAILURE` code. Also add a check for the interrupt condition during GUI startup. Returning `EXIT_SUCCESS` seems to be the usual behaviour for daemons, see the discussion on IRC for this: https://www.erisian.com.au/bitcoin-core-dev/log-2026-01-08.html#l-146 . Best reviewed with `--color-moved=dimmed-zebra --color-moved-ws=ignore-all-space`. ACKs for top commit: maflcko: review ACK997e7b4d7c🔺 janb84: ACK997e7b4d7cdergoegge: utACK997e7b4d7cTree-SHA512: c9542e95d9312567e029426a329144b5bc638d8ebc9c966e0246c1bb728d40f56ca425b00c446f5d238067e629c2337d0fe78bcc5a8760424d2ec38a5578e115
This commit is contained in:
2 files changed
+7
-6
No files matched your search
+2
-2
@@ -1842,7 +1842,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
|||||||
// requested to kill the GUI during the last operation. If so, exit.
|
// requested to kill the GUI during the last operation. If so, exit.
|
||||||
if (ShutdownRequested(node)) {
|
if (ShutdownRequested(node)) {
|
||||||
LogInfo("Shutdown requested. Exiting.");
|
LogInfo("Shutdown requested. Exiting.");
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ChainstateManager& chainman = *Assert(node.chainman);
|
ChainstateManager& chainman = *Assert(node.chainman);
|
||||||
@@ -2018,7 +2018,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ShutdownRequested(node)) {
|
if (ShutdownRequested(node)) {
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ********************************************************* Step 12: start node
|
// ********************************************************* Step 12: start node
|
||||||
|
|||||||
+5
-4
@@ -380,7 +380,11 @@ void BitcoinApplication::initializeResult(bool success, interfaces::BlockAndHead
|
|||||||
{
|
{
|
||||||
qDebug() << __func__ << ": Initialization result: " << success;
|
qDebug() << __func__ << ": Initialization result: " << success;
|
||||||
|
|
||||||
if (success) {
|
if (!success || m_node->shutdownRequested()) {
|
||||||
|
requestShutdown();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
delete m_splash;
|
delete m_splash;
|
||||||
m_splash = nullptr;
|
m_splash = nullptr;
|
||||||
|
|
||||||
@@ -424,9 +428,6 @@ void BitcoinApplication::initializeResult(bool success, interfaces::BlockAndHead
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
pollShutdownTimer->start(SHUTDOWN_POLLING_DELAY);
|
pollShutdownTimer->start(SHUTDOWN_POLLING_DELAY);
|
||||||
} else {
|
|
||||||
requestShutdown();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BitcoinApplication::handleRunawayException(const QString &message)
|
void BitcoinApplication::handleRunawayException(const QString &message)
|
||||||
|
|||||||
Reference in new issue
Block a user