Skip to content

Commit 8edb5f4

Browse files
authored
Update cleanup.js
1 parent 1d6ef1b commit 8edb5f4

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

cleanup.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
1+
const axios = require('axios');
12
const isWindows = process.platform === 'win32';
23

3-
const kill = (process) => {
4+
const kill = async (process) => {
5+
try {
6+
// Call the shutdown API
7+
await axios.post('http://localhost:5000/shutdown');
8+
console.log('Shutdown API called successfully.');
9+
} catch (error) {
10+
console.error('Error calling shutdown API:', error);
11+
}
12+
13+
// Fallback if API fails or for local process termination
414
if (isWindows) {
515
const kill = require('tree-kill');
616
kill(process.pid);

0 commit comments

Comments
 (0)