Quellcode durchsuchen

Gestion des Ctrl+C

Arthur Brandao vor 5 Jahren
Ursprung
Commit
23efc550e2
1 geänderte Dateien mit 6 neuen und 0 gelöschten Zeilen
  1. 6 0
      node/main.js

+ 6 - 0
node/main.js

@@ -1,5 +1,11 @@
 #!/usr/bin/env node
 
+// Gestion du signal d'arret (SIGINT = Ctrl+C)
+process.on('SIGINT', function() {
+    console.info("\nStopping the server");
+    process.exit();
+});
+
 // Gestion des commandes et des options de l'application
 const argv = require('yargs')
     .command('serve [port]', 'start the Loquicompta server', (yargs) => {