Skip to content

Commit eb7ea78

Browse files
committed
squash! add handler for event listener
1 parent 6d27376 commit eb7ea78

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/readline.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,6 @@ function emitKeypressEvents(stream, iface) {
10301030
function onNewListener(event) {
10311031
if (event === 'keypress') {
10321032
stream.on('data', onData);
1033-
iface.once('close', () => { stream.removeListener('data', onData); });
10341033
stream.removeListener('newListener', onNewListener);
10351034
}
10361035
}
@@ -1040,6 +1039,9 @@ function emitKeypressEvents(stream, iface) {
10401039
} else {
10411040
stream.on('newListener', onNewListener);
10421041
}
1042+
if (iface) {
1043+
iface.once('close', () => { stream.removeListener('data', onData); });
1044+
}
10431045
}
10441046

10451047
/**

0 commit comments

Comments
 (0)