Spaces:
Runtime error
Runtime error
Commit
·
b720f38
1
Parent(s):
790227e
try to make it (a bit) cleaner to exit
Browse files- src/index.mts +11 -0
src/index.mts
CHANGED
@@ -22,4 +22,15 @@ app.get('/', async (req, res) => {
|
|
22 |
</html>`)
|
23 |
res.end()
|
24 |
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
app.listen(port, () => { console.log(`Open http://localhost:${port}`) })
|
|
|
22 |
</html>`)
|
23 |
res.end()
|
24 |
})
|
25 |
+
|
26 |
+
process.on('SIGINT', () => {
|
27 |
+
try {
|
28 |
+
(python as any).exit()
|
29 |
+
} catch (err) {
|
30 |
+
// exiting Pythonia can get a bit messy: try/catch or not,
|
31 |
+
// you *will* see warnings and tracebacks in the console
|
32 |
+
}
|
33 |
+
process.exit(0)
|
34 |
+
})
|
35 |
+
|
36 |
app.listen(port, () => { console.log(`Open http://localhost:${port}`) })
|