Skip to content

Commit f59b888

Browse files
addaleaxjasnell
authored andcommitted
repl: disable Ctrl+C support on win32 for now
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: #7837 PR-URL: #7977 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Nikolai Vavilov <vvnicholas@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: João Reis <reis@janeasystems.com>
1 parent 43ef580 commit f59b888

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

lib/repl.js

+9-2
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,13 @@ function REPLServer(prompt,
289289
if (!err) {
290290
// Unset raw mode during evaluation so that Ctrl+C raises a signal.
291291
let previouslyInRawMode;
292-
if (self.breakEvalOnSigint) {
292+
293+
// Temporarily disabled on Windows due to output problems that likely
294+
// result from the raw mode switches here, see
295+
// https://github.com/nodejs/node/issues/7837
296+
// Setting NODE_REPL_CTRLC is meant as a temporary opt-in for debugging.
297+
if (self.breakEvalOnSigint &&
298+
(process.platform !== 'win32' || process.env.NODE_REPL_CTRLC)) {
293299
// Start the SIGINT watchdog before entering raw mode so that a very
294300
// quick Ctrl+C doesn’t lead to aborting the process completely.
295301
utilBinding.startSigintWatchdog();
@@ -309,7 +315,8 @@ function REPLServer(prompt,
309315
result = script.runInContext(context, scriptOptions);
310316
}
311317
} finally {
312-
if (self.breakEvalOnSigint) {
318+
if (self.breakEvalOnSigint &&
319+
(process.platform !== 'win32' || process.env.NODE_REPL_CTRLC)) {
313320
// Reset terminal mode to its previous value.
314321
self._setRawMode(previouslyInRawMode);
315322

0 commit comments

Comments
 (0)