From d8ac5eace60876816c4fdd3a0b854f934f28181f Mon Sep 17 00:00:00 2001 From: Andrew Bradley Date: Wed, 29 Jul 2020 03:40:16 -0400 Subject: [PATCH 1/5] NODE_NO_READLINE support https://nodejs.org/api/repl.html#repl_using_the_node_js_repl_with_advanced_line_editors --- src/bin.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin.ts b/src/bin.ts index 001e1f483..761ea5fc1 100644 --- a/src/bin.ts +++ b/src/bin.ts @@ -365,7 +365,7 @@ function startRepl (service: Register, state: EvalState, code?: string) { prompt: '> ', input: process.stdin, output: process.stdout, - terminal: process.stdout.isTTY, + terminal: process.stdout.isTTY && !parseInt(process.env.NODE_NO_READLINE), eval: replEval, useGlobal: true }) From 992130b5f9bc9afa7ab752ee0cee39f4320f8c11 Mon Sep 17 00:00:00 2001 From: Andrew Bradley Date: Wed, 29 Jul 2020 03:44:03 -0400 Subject: [PATCH 2/5] Update bin.ts --- src/bin.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin.ts b/src/bin.ts index 761ea5fc1..27fea787f 100644 --- a/src/bin.ts +++ b/src/bin.ts @@ -365,7 +365,7 @@ function startRepl (service: Register, state: EvalState, code?: string) { prompt: '> ', input: process.stdin, output: process.stdout, - terminal: process.stdout.isTTY && !parseInt(process.env.NODE_NO_READLINE), + terminal: process.stdout.isTTY && !parseInt(process.env.NODE_NO_READLINE!), eval: replEval, useGlobal: true }) From 7cd68fec3f95de541bd02f6a4a2e8689ddf69731 Mon Sep 17 00:00:00 2001 From: Andrew Bradley Date: Wed, 29 Jul 2020 03:58:40 -0400 Subject: [PATCH 3/5] Update bin.ts --- src/bin.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin.ts b/src/bin.ts index 27fea787f..98da29967 100644 --- a/src/bin.ts +++ b/src/bin.ts @@ -365,7 +365,7 @@ function startRepl (service: Register, state: EvalState, code?: string) { prompt: '> ', input: process.stdin, output: process.stdout, - terminal: process.stdout.isTTY && !parseInt(process.env.NODE_NO_READLINE!), + terminal: process.stdout.isTTY && !parseInt(process.env.NODE_NO_READLINE!), // tslint:disable-line eval: replEval, useGlobal: true }) From 41a0392f882877353af8117e4c0368e3a92e68ba Mon Sep 17 00:00:00 2001 From: Andrew Bradley Date: Wed, 29 Jul 2020 04:02:00 -0400 Subject: [PATCH 4/5] Update bin.ts --- src/bin.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin.ts b/src/bin.ts index 98da29967..869a1335e 100644 --- a/src/bin.ts +++ b/src/bin.ts @@ -365,7 +365,7 @@ function startRepl (service: Register, state: EvalState, code?: string) { prompt: '> ', input: process.stdin, output: process.stdout, - terminal: process.stdout.isTTY && !parseInt(process.env.NODE_NO_READLINE!), // tslint:disable-line + terminal: process.stdout.isTTY && !parseInt(process.env.NODE_NO_READLINE!, 10), eval: replEval, useGlobal: true }) From b65c761ae019c6e9c5cd35cf83d0f2253b3933d1 Mon Sep 17 00:00:00 2001 From: Andrew Bradley Date: Wed, 29 Jul 2020 14:57:57 -0400 Subject: [PATCH 5/5] Update bin.ts --- src/bin.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bin.ts b/src/bin.ts index 869a1335e..b85ee8869 100644 --- a/src/bin.ts +++ b/src/bin.ts @@ -365,6 +365,7 @@ function startRepl (service: Register, state: EvalState, code?: string) { prompt: '> ', input: process.stdin, output: process.stdout, + // Mimicking node's REPL implementation: https://github.com/nodejs/node/blob/168b22ba073ee1cbf8d0bcb4ded7ff3099335d04/lib/internal/repl.js#L28-L30 terminal: process.stdout.isTTY && !parseInt(process.env.NODE_NO_READLINE!, 10), eval: replEval, useGlobal: true