File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
src/vs/base/common/codecs Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -119,9 +119,15 @@ export abstract class BaseDecoder<
119119 }
120120 this . started = true ;
121121
122- this . stream . on ( 'data' , this . tryOnStreamData ) ;
123- this . stream . on ( 'error' , this . onStreamError ) ;
122+ /**
123+ * !NOTE! The order of event subscriptions is critical here because
124+ * the `data` event is also starts the stream, hence changing
125+ * the order of event subscriptions can lead to race conditions.
126+ * See {@link ReadableStreamEvents} for more info.
127+ */
124128 this . stream . on ( 'end' , this . onStreamEnd ) ;
129+ this . stream . on ( 'error' , this . onStreamError ) ;
130+ this . stream . on ( 'data' , this . tryOnStreamData ) ;
125131
126132 // this allows to compose decoders together, - if a decoder
127133 // instance is passed as a readable stream to this decoder,
You can’t perform that action at this time.
0 commit comments