Add grateful exit on SIGINT AND SIGTERM
All checks were successful
ci/woodpecker/push/build Pipeline was successful

This commit is contained in:
Alessio Davoli 2023-07-19 16:00:34 +02:00
parent 3b0df1ddfe
commit 8e4bf59686
2 changed files with 10 additions and 1 deletions

8
frontend/add-sigint.sh Executable file
View file

@ -0,0 +1,8 @@
#!/usr/bin/bash
echo "function shutdownGracefully() {
process.exit(0);
}
process.on('SIGINT', shutdownGracefully);
process.on('SIGTERM', shutdownGracefully);" >> ./build/index.js

View file

@ -4,7 +4,8 @@
"private": true,
"scripts": {
"dev": "vite dev",
"build": "vite build",
"build": "vite build && yarn add-sigint",
"add-sigint": "./add-sigint.sh",
"preview": "vite preview",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",