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