From f59b8888f12b491c69cc5be6f812414d50b1ec36 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Thu, 4 Aug 2016 14:51:10 +0200 Subject: [PATCH] repl: disable Ctrl+C support on win32 for now MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Disable Windows support for interrupting REPL commands using Ctrl+C by default, because the switches from console raw mode and back have been interfering with printing the results of evaluated expressions. This is a temporary measure, since the underlying problem is very likely not related to this specific feature. Ref: https://github.com/nodejs/node/issues/7837 PR-URL: https://github.com/nodejs/node/pull/7977 Reviewed-By: James M Snell Reviewed-By: Nikolai Vavilov Reviewed-By: Colin Ihrig Reviewed-By: João Reis --- lib/repl.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/repl.js b/lib/repl.js index cfc9ffe6028a13..e57b23946bb528 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -289,7 +289,13 @@ function REPLServer(prompt, if (!err) { // Unset raw mode during evaluation so that Ctrl+C raises a signal. let previouslyInRawMode; - if (self.breakEvalOnSigint) { + + // Temporarily disabled on Windows due to output problems that likely + // result from the raw mode switches here, see + // https://github.com/nodejs/node/issues/7837 + // Setting NODE_REPL_CTRLC is meant as a temporary opt-in for debugging. + if (self.breakEvalOnSigint && + (process.platform !== 'win32' || process.env.NODE_REPL_CTRLC)) { // Start the SIGINT watchdog before entering raw mode so that a very // quick Ctrl+C doesn’t lead to aborting the process completely. utilBinding.startSigintWatchdog(); @@ -309,7 +315,8 @@ function REPLServer(prompt, result = script.runInContext(context, scriptOptions); } } finally { - if (self.breakEvalOnSigint) { + if (self.breakEvalOnSigint && + (process.platform !== 'win32' || process.env.NODE_REPL_CTRLC)) { // Reset terminal mode to its previous value. self._setRawMode(previouslyInRawMode);