dthree / vorpal

Node's framework for interactive CLIs

Home Page:http://vorpal.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is there an 'exit' event I can subscribe?

ludaac opened this issue · comments

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?

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

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

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