Security fixes pass #2

This commit is contained in:
2026-04-19 16:00:59 +01:00
parent 3b26292124
commit b702e26bf6
40 changed files with 305 additions and 93 deletions
+17
View File
@@ -3,6 +3,10 @@ import path from "path";
import type { BunSpawnOptions } from "../../types";
import writeErrorFile from "../../functions/write-error-file";
let retries = 0;
let timeout: any;
const MAX_RETRIES = 5;
export default function () {
return new Command("start")
.description("Start production server")
@@ -12,6 +16,13 @@ export default function () {
}
async function start() {
clearTimeout(timeout);
if (retries >= MAX_RETRIES) {
console.error(`Production server crashed ${MAX_RETRIES} times. Exiting.`);
process.exit(1);
}
const dev_spawn_file = path.resolve(__dirname, "prod-spawn.ts");
const spawn_options: BunSpawnOptions = {
@@ -28,6 +39,12 @@ async function start() {
let dev_process = Bun.spawn(spawn_options);
retries++;
timeout = setTimeout(() => {
retries = 0;
}, 10000);
const exited = await dev_process.exited;
if (exited) {