dthree / vorpal

Node's framework for interactive CLIs
http://vorpal.js.org
MIT License
5.63k stars 278 forks source link

Is there an 'exit' event I can subscribe? #306

Closed ludaac closed 5 years ago

ludaac commented 6 years ago

I'm trying to build a simple application openning a database and making some queries in it with some commands. To avoid open/close connections to sqlite with every command I want to have a single connection and kepp it open while vorpal is running.

Is there a way to know the 'exit' command was sent and react to it?

johncblandii commented 6 years ago
process.on('exit', (code) => {
  console.log(`About to exit with code: ${code}`);
});

https://nodejs.org/api/process.html#process_event_exit

ludaac commented 5 years ago

Thanks! That makes sense. I should have read the documentation first.