-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrunner.js
More file actions
37 lines (31 loc) ยท 1.41 KB
/
Copy pathrunner.js
File metadata and controls
37 lines (31 loc) ยท 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { spawn } from 'child_process';
import os from 'os';
console.log('========================================================');
console.log('๐ฌ Starting GeirdevVideoGen...');
console.log('========================================================\n');
// 1. ๋ฐฑ์๋ ๋ธ๋ฆฟ์ง ์๋ฒ ๊ฐ๋ (bridge.js)
const bridge = spawn('node', ['bridge.js'], { stdio: 'inherit', shell: true });
// 2. ํ๋ก ํธ์๋ Vite ์น ์คํ๋์ค ๊ฐ๋ ๋ฐ ๋ธ๋ผ์ฐ์ ์๋ ์คํ (--open ํ๋๊ทธ ์ฐ๋)
const vite = spawn('npx', ['vite', '--open'], { stdio: 'inherit', shell: true });
// Clean up all spawned child processes on sudden SIGINT/SIGTERM exits
const cleanup = () => {
console.log('\n๐ Shutting down servers and releasing active ports.');
try {
if (os.platform() === 'win32') {
// Windows์ ๊ฒฝ์ฐ ํ์คํฌ ํธ๋ฆฌ ์ ์ฒด ๊ฐ์ ์ข
๋ฃ
spawn('taskkill', ['/pid', bridge.pid, '/f', '/t'], { shell: true });
spawn('taskkill', ['/pid', vite.pid, '/f', '/t'], { shell: true });
} else {
bridge.kill('SIGINT');
vite.kill('SIGINT');
}
} catch (e) {
// ์ด๋ฏธ ์ข
๋ฃ๋ ํ๋ก์ธ์ค์ ๋ํ ์์ธ ๋ฐฉ์ง
}
process.exit();
};
process.on('SIGINT', cleanup);
process.on('SIGTERM', cleanup);
// Error listeners
bridge.on('error', (err) => console.error('โ ๏ธ Bridge server startup error:', err));
vite.on('error', (err) => console.error('โ ๏ธ Web frontend startup error:', err));