fix(cli): set cron run exit code from run outcome (land #31121 by @Sid-Qin)

Landed-from: #31121
Contributor: @Sid-Qin
Co-authored-by: Sid <sidqin0410@gmail.com>
This commit is contained in:
Peter Steinberger
2026-03-02 01:58:25 +00:00
parent 9670ccfc41
commit ffe1937b92
3 changed files with 55 additions and 0 deletions

View File

@@ -100,6 +100,8 @@ export function registerCronSimpleCommands(cron: Command) {
mode: opts.due ? "due" : "force",
});
defaultRuntime.log(JSON.stringify(res, null, 2));
const result = res as { ok?: boolean; ran?: boolean } | undefined;
defaultRuntime.exit(result?.ok && result?.ran ? 0 : 1);
} catch (err) {
defaultRuntime.error(danger(String(err)));
defaultRuntime.exit(1);