mirror of
https://github.com/WonderAliceUwU/OmniArr.git
synced 2026-11-21 11:35:56 +00:00
⭐️ feature: first app steps
This commit is contained in:
commit
7d9343ead3
51 files changed
+8226
No files matched your search
@@ -0,0 +1,36 @@
|
||||
import { spawn, type ChildProcess } from 'node:child_process'
|
||||
|
||||
const npmCommand = process.platform === 'win32' ? 'npm.cmd' : 'npm'
|
||||
|
||||
const children: ChildProcess[] = [
|
||||
spawn(npmCommand, ['run', 'dev:server'], {
|
||||
stdio: 'inherit',
|
||||
env: process.env,
|
||||
}),
|
||||
spawn(npmCommand, ['run', 'dev', '--', '--host', '0.0.0.0'], {
|
||||
stdio: 'inherit',
|
||||
env: process.env,
|
||||
}),
|
||||
]
|
||||
|
||||
for (const child of children) {
|
||||
child.on('exit', (code) => {
|
||||
shutdown(code ?? 0)
|
||||
})
|
||||
}
|
||||
|
||||
for (const signal of ['SIGINT', 'SIGTERM'] as const) {
|
||||
process.on(signal, () => {
|
||||
shutdown(0)
|
||||
})
|
||||
}
|
||||
|
||||
function shutdown(code: number) {
|
||||
for (const child of children) {
|
||||
if (!child.killed) {
|
||||
child.kill('SIGTERM')
|
||||
}
|
||||
}
|
||||
|
||||
process.exit(code)
|
||||
}
|
||||
Reference in new issue
Block a user