in transform stream transform method, `callback(null, null)` doesn't end stream but `this.push(null); callback()` does
Nessuno ha ancora preso questa issue.
- Lingua principale
- JavaScript
- Stelle
- 122k
- Fork
- 37.3k
- Merge medio
- 4g 2h
- PR unite (30g)
- 283
Descrizione
Version
latest main branch
Platform
irrelevant
Subsystem
stream
What steps will reproduce the bug?
https://nodejs.org/api/stream.html#transform-transformchunk-encoding-callback
callback(null, null) doesn't end stream but this.push(null); callback() does
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
callback(null, null) and this.push(null); callback() have the same effect (the stream ends).
What do you see instead?
callback(null, null) is different from this.push(null); callback()
Additional information
https://github.com/nodejs/node/blob/main/lib/internal/streams/transform.js#L177-L179
Would it be possible to change this to the following?
if (val !== undefined) {
this.push(val)
}
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia in lib/internal/streams/transform.js alle righe 177-179 e confronta il comportamento documentato del callback di Transform con l'implementazione esistente dello stream. Riproduci la differenza tra callback(null, null) e this.push(null); callback(), quindi esamina i test pertinenti dello stream. Il lavoro è completato quando entrambe le forme terminano lo stream in modo coerente, come descritto.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript
- Ambito
- stream-processing
- Tipo di issue
- Bug
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Stato di attività
- Tranquilla
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 76/100