File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -165,12 +165,15 @@ export default class StreamAsyncToIterator {
165165 eventListener = ( ) => {
166166 this . _state = states . readable ;
167167 this . _rejections . delete ( reject ) ;
168+
169+ // we set this to null to info the clean up not to do anything
170+ eventListener = null ;
168171 resolve ( ) ;
169172 } ;
170173
171174 //on is used here instead of once, because
172175 //the listener is remove afterwards anyways.
173- this . _stream . on ( 'readable' , eventListener ) ;
176+ this . _stream . once ( 'readable' , eventListener ) ;
174177 this . _rejections . add ( reject ) ;
175178 } ) ;
176179
@@ -194,10 +197,12 @@ export default class StreamAsyncToIterator {
194197 eventListener = ( ) => {
195198 this . _state = states . ended ;
196199 this . _rejections . delete ( reject ) ;
200+
201+ eventListener = null
197202 resolve ( ) ;
198203 } ;
199204
200- this . _stream . on ( 'end' , eventListener ) ;
205+ this . _stream . once ( 'end' , eventListener ) ;
201206 this . _rejections . add ( reject ) ;
202207 } ) ;
203208
You can’t perform that action at this time.
0 commit comments