From e2aa74972ce84388a49090533e353b61bd9b16ed Mon Sep 17 00:00:00 2001 From: Vojta Jina Date: Sat, 7 Dec 2013 14:25:25 -0800 Subject: [PATCH] fix(init): clean the terminal if killed Before, when user terminates `karma init` during answering a question, the terminal would stay colored. --- lib/init.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/init.js b/lib/init.js index d4cbee2f7..50e3bbc47 100755 --- a/lib/init.js +++ b/lib/init.js @@ -349,6 +349,12 @@ exports.init = function(config) { rli.on('line', sm.onLine.bind(sm)); + // clean colors + rli.on('SIGINT', function() { + rli.write(colors.END + '\n'); + process.exit(0); + }); + sm.process(questions, function(answers) { var cwd = process.cwd(); var configFile = config.configFile || 'karma.conf.js';