From 7f20b17a59058f23fb74883866e70ad8a6d21b03 Mon Sep 17 00:00:00 2001 From: Shish Date: Tue, 16 Jan 2024 01:28:44 +0000 Subject: [PATCH] [cli] don't exit until after we have committed or rolled back the db --- core/cli_app.php | 1 + index.php | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/core/cli_app.php b/core/cli_app.php index 19fdf293..3867f7b0 100644 --- a/core/cli_app.php +++ b/core/cli_app.php @@ -12,6 +12,7 @@ class CliApp extends \Symfony\Component\Console\Application public function __construct() { parent::__construct('Shimmie', VERSION); + $this->setAutoExit(false); } protected function getDefaultInputDefinition(): InputDefinition diff --git a/index.php b/index.php index 63470ae2..1d02f036 100644 --- a/index.php +++ b/index.php @@ -84,7 +84,9 @@ try { ob_implicit_flush(true); $app = new CliApp(); send_event(new CliGenEvent($app)); - $app->run(); + if($app->run() !== 0) { + throw new \Exception("CLI command failed"); + } } else { send_event(new PageRequestEvent($_SERVER['REQUEST_METHOD'], _get_query())); $page->display();