doc: add warning to readline's close() method

When close() is called on a readline instance, it is possible
that data is already buffered, and will trigger 'line' events.
This commit adds a warning to the corresponding docs. Note that
a similar warning already exists for the pause() method.

PR-URL: https://github.com/nodejs/node/pull/22679
Fixes: https://github.com/nodejs/node/issues/22615
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: George Adams <george.adams@uk.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This commit is contained in:
cjihrig 2018-09-03 17:39:09 -04:00
parent ed976d76b0
commit 83c1ba3180
No known key found for this signature in database
GPG Key ID: 7434390BDBE9B9C5

View File

@ -195,6 +195,9 @@ The `rl.close()` method closes the `readline.Interface` instance and
relinquishes control over the `input` and `output` streams. When called, relinquishes control over the `input` and `output` streams. When called,
the `'close'` event will be emitted. the `'close'` event will be emitted.
Calling `rl.close()` does not immediately stop other events (including `'line'`)
from being emitted by the `readline.Interface` instance.
### rl.pause() ### rl.pause()
<!-- YAML <!-- YAML
added: v0.3.4 added: v0.3.4