Skip to content

Commit bbf6007

Browse files
committed
fix: Keep gmgui promise pending to maintain process uptime
Return a promise that never resolves or rejects, keeping the gmgui process alive indefinitely. This ensures the server keeps running when executed via bunx.
1 parent 47a5c3d commit bbf6007

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

bin/gmgui.cjs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,19 @@ async function gmgui(args = []) {
4848
stdio: 'inherit'
4949
});
5050

51-
ps.on('error', reject);
52-
53-
// Keep this process alive indefinitely to keep the server running
54-
process.stdin.resume();
51+
ps.on('error', (err) => {
52+
console.error(`Failed to start server: ${err.message}`);
53+
reject(err);
54+
});
5555

56-
// If server exits, keep this process alive
5756
ps.on('exit', (code) => {
5857
if (code !== 0) {
5958
console.error(`Server exited with code ${code}`);
59+
// Don't reject - keep the promise pending so process stays alive
6060
}
6161
});
62+
63+
// Never resolve this promise - keeps the process alive indefinitely
6264
});
6365
} else {
6466
throw new Error(`Unknown command: ${command}`);

0 commit comments

Comments
 (0)