diff --git a/src/cli/run.js b/src/cli/run.js index c4238f473..8e72b96c8 100644 --- a/src/cli/run.js +++ b/src/cli/run.js @@ -167,7 +167,12 @@ module.exports = function (argv) { console.log(` Creating a snapshot from the CLI won't be possible`) }) process.stdin.setEncoding('utf8') - process.stdin.on('data', (chunk) => { + process.stdin.on('data', async (chunk) => { + // ctrl+c or ctrl+d + if (chunk === '\x03' || chunk === '\x04') { + await server.destroy(() => process.exit(0)) + return + } if (chunk.trim().toLowerCase() === 's') { const filename = `db-${Date.now()}.json` const file = path.join(argv.snapshots, filename)