forked from nodejs/node-v0.x-archive
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
stream: notify user of to pipe state via 'unpipe' event.
- Loading branch information
1 parent
f692347
commit bc1e02c
Showing
1 changed file
with
3 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -101,6 +101,8 @@ Stream.prototype.pipe = function(dest, options) { | |
|
||
dest.removeListener('end', cleanup); | ||
dest.removeListener('close', cleanup); | ||
|
||
source.emit('unpipe', dest); | ||
} | ||
|
||
source.on('end', cleanup); | ||
|
@@ -109,7 +111,7 @@ Stream.prototype.pipe = function(dest, options) { | |
dest.on('end', cleanup); | ||
dest.on('close', cleanup); | ||
|
||
dest.emit('pipe', source); | ||
dest.emit('pipe', source, cleanup); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
dominictarr
Author
Owner
|
||
|
||
// Allow for unix-like usage: A.pipe(B).pipe(C) | ||
return dest; | ||
|
Why is the cleanup function passed to the dest's pipe event?