[cli] don't exit until after we have committed or rolled back the db

This commit is contained in:
Shish 2024-01-16 01:28:44 +00:00
parent 83f3ae99eb
commit 7f20b17a59
2 changed files with 4 additions and 1 deletions

View file

@ -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

View file

@ -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();