From f0702b6e60bbcda923ab92539078aa736a8092da Mon Sep 17 00:00:00 2001 From: mattp <1196252+mattpr@users.noreply.github.com> Date: Thu, 3 Mar 2022 13:44:39 +0100 Subject: [PATCH 1/2] doc: readline `'line'` event emits final line Updated docs to reflect current behaviour of readline: final line of input will be emitted via `'line'` event when input stream `'end'` event is emitted even when the input is not newline terminated. Refs: https://github.com/nodejs/node-v0.x-archive/issues/7238 --- doc/api/readline.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/api/readline.md b/doc/api/readline.md index 636dbc7a7a78de..cac8e9e284a68a 100644 --- a/doc/api/readline.md +++ b/doc/api/readline.md @@ -109,7 +109,10 @@ added: v0.1.98 The `'line'` event is emitted whenever the `input` stream receives an end-of-line input (`\n`, `\r`, or `\r\n`). This usually occurs when the user -presses Enter or Return. +presses Enter or Return. + +The `'line'` event is also emitted if new data has been read from a stream and +that stream ends without a final end-of-line marker. The listener function is called with a string containing the single line of received input. From 74a752ce83f4177778856300ee30d97fe84eaea7 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 4 Mar 2022 08:11:08 -0800 Subject: [PATCH 2/2] Update doc/api/readline.md Co-authored-by: Antoine du Hamel --- doc/api/readline.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/readline.md b/doc/api/readline.md index cac8e9e284a68a..724fbc6be99afc 100644 --- a/doc/api/readline.md +++ b/doc/api/readline.md @@ -109,7 +109,7 @@ added: v0.1.98 The `'line'` event is emitted whenever the `input` stream receives an end-of-line input (`\n`, `\r`, or `\r\n`). This usually occurs when the user -presses Enter or Return. +presses Enter or Return. The `'line'` event is also emitted if new data has been read from a stream and that stream ends without a final end-of-line marker.