SPB Git forge

spb/spbgit

Public MIT ★ Pinned

SPB Git — the platform hosting itself

15commits 1branches 1releases
833.0 KBsize
maindefault branch
17 days agolast push
JavaScript 67.4% CSS 16.7% Nunjucks 13.7% Shell 2.3%

fix: start main() under pm2 fork mode (pm_exec_path guard)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Simon-Pierre Boucher committed 1 mo ago (Aug 10, 2026) parent c0789da

1 changed file +5 −1

modified src/server.mjs +5 −1
@@ -220,6 +220,10 @@ async function main() {
220 220 }
221 221 }
222 222
223 −if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
223 +// Run when invoked directly (node src/server.mjs) or under pm2 fork mode,
224 +// where argv[1] is pm2's ProcessContainerFork and pm_exec_path is our script.
225 +const invokedDirectly = process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href;
226 +const underPm2 = (process.env.pm_exec_path ?? '').endsWith('server.mjs');
227 +if (invokedDirectly || underPm2) {
224 228 main();
225 229 }
226 230