mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-17 20:32:25 +03:00
Same fix pattern #7049 already applied to `dashboard`: dropping the Commander default `20128` on `restart --port` lets `opts.port` stay undefined so `runServe()`s `opts.port ?? process.env.PORT ?? "20128"` fallback can actually reach `PORT`. 3 files, +36/-1. Thanks, @datrixlab — matching the existing precedent instead of inventing a new mechanism made this trivial to review. **Batch validation** — boarded with the other 10 PRs of your batch into one worktree cut from `release/v3.8.51`; every PR verified as an ancestor of the combined HEAD before validating. - Focused tests across all 11 PRs: **104/104 pass** on the combined tree. - Gates on the combined tree: `check-changelog-integrity` PASS, `check-complexity` PASS, `check-cognitive-complexity` PASS, `typecheck:core` PASS, `check:open-sse-typecheck` PASS. - `check-file-size` is red, but reproduces with byte-identical line counts on the pure `release/v3.8.51` tip (`open-sse/handlers/imageGeneration.ts` 3304, `open-sse/services/combo/roundRobinCombo.ts` 1221, `open-sse/utils/stream.ts` 3115). Inherited base-red, nothing added by this batch — it is also why this PR's "Fast Quality Gates" check was red.
27 lines
748 B
JavaScript
27 lines
748 B
JavaScript
import { t } from "../i18n.mjs";
|
|
import { runStopCommand } from "./stop.mjs";
|
|
import { sleep } from "../utils/pid.mjs";
|
|
|
|
export function registerRestart(program) {
|
|
program
|
|
.command("restart")
|
|
.description(t("restart.description"))
|
|
// No Commander default: runServe() falls back to PORT, then 20128 (#7049).
|
|
.option("--port <port>", t("serve.port"))
|
|
.action(async (opts) => {
|
|
const exitCode = await runRestartCommand(opts);
|
|
if (exitCode !== 0) process.exit(exitCode);
|
|
});
|
|
}
|
|
|
|
export async function runRestartCommand(opts = {}) {
|
|
console.log(t("restart.restarting"));
|
|
|
|
await runStopCommand(opts);
|
|
await sleep(1000);
|
|
|
|
const { runServe } = await import("./serve.mjs");
|
|
await runServe(opts);
|
|
return 0;
|
|
}
|