Sfoglia il codice sorgente

Gestion des Ctrl+C

Arthur Brandao 5 anni fa
parent
commit
23efc550e2
1 ha cambiato i file con 6 aggiunte e 0 eliminazioni
  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) => {