mirror of
https://github.com/neynarxyz/create-farcaster-mini-app.git
synced 2025-11-16 08:08:56 -05:00
fix: cleanup dev server exit code
This commit is contained in:
parent
109569924d
commit
f02b4064db
20
dev.js
20
dev.js
@ -3,6 +3,7 @@ import { spawn } from 'child_process';
|
||||
|
||||
let tunnel;
|
||||
let nextDev;
|
||||
let isCleaningUp = false;
|
||||
|
||||
async function startDev() {
|
||||
// Start localtunnel and get URL
|
||||
@ -16,16 +17,25 @@ async function startDev() {
|
||||
});
|
||||
|
||||
// Handle cleanup
|
||||
const cleanup = () => {
|
||||
if (tunnel) {
|
||||
tunnel.close();
|
||||
console.log('\n🌐 Tunnel closed');
|
||||
}
|
||||
const cleanup = async () => {
|
||||
if (isCleaningUp) return;
|
||||
isCleaningUp = true;
|
||||
|
||||
try {
|
||||
if (nextDev) {
|
||||
nextDev.kill();
|
||||
console.log('\n🛑 Next.js dev server stopped');
|
||||
}
|
||||
|
||||
if (tunnel) {
|
||||
await tunnel.close();
|
||||
console.log('\n🌐 Tunnel closed');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error during cleanup:', error);
|
||||
} finally {
|
||||
process.exit(0);
|
||||
}
|
||||
};
|
||||
|
||||
// Handle process termination
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user