Skip to content

Commit 1740c42

Browse files
committed
create a child process to exit vit application on process kill
1 parent 2e0ca3c commit 1740c42

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

client/client-server.js

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { exec } from 'child_process';
2+
3+
const vite = exec('npx vite');
4+
5+
vite.stdout.on('data', (data) => {
6+
console.log(data.toString());
7+
});
8+
9+
vite.stderr.on('data', (data) => {
10+
console.error(data.toString());
11+
});
12+
13+
process.on('SIGINT', () => {
14+
console.log('Killing Vite process');
15+
vite.kill('SIGINT');
16+
process.exit();
17+
});

client/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
},
4848
"scripts": {
4949
"start": "vite --force",
50+
"windows-start": "node client-server.js",
5051
"build": "vite build",
5152
"test": "jest",
5253
"format": "prettier --write ."

0 commit comments

Comments
 (0)