Uh oh!
There was an error while loading. Please reload this page.
fs: make SyncWriteStream inherit from Writable - #8830
Conversation
Make the internal `SyncWriteStream` a proper `stream.Writable` subclass. This allows for quite a bit of simplification, since `SyncWriteStream` predates the streams2/streams3 implementations. Fixes: nodejs#8828
| // when stdout/stderr point to files. | ||
| if (process.argv[2] === 'child') { | ||
| console.log(JSON.stringify([process.stdout, process.stderr].map((stdio) => ({ |
There was a problem hiding this comment.
Nit: Perhaps a note here quickly indicating that the console.log is intentional and part of the test? There are plenty of places around in the tests where console.log is used without serving much purpose.
addaleax
commented
Sep 28, 2016
Fishrock123
left a comment
There was a problem hiding this comment.
LGTM if tests pass, maybe also run citgm on it.
That being said, I think this is only a step, and we should switch to net.Socket so that people don't reply on things that may not be in Socket, and don;t have to patch for Socket functionality.
Fishrock123
commented
Sep 28, 2016
Actually, that is due to an understanding of mine that |
Fishrock123
commented
Sep 28, 2016
Hmmm, |
thefourtheye
commented
Sep 28, 2016
cc @nodejs/streams |
addaleax
commented
Sep 28, 2016
Hmmm. On the one hand, |
mcollina
commented
Sep 29, 2016
I agree. But that might be a semver-major change. The debug module depends on @addaleax can you verify that debug still works with this change? I'm flagging this as semver-minor, pending CITGM and the assessment on debug. |
addaleax
commented
Sep 29, 2016
Ostensibly, yes. I’m not even sure what they are using it for, so I’d probably have to take the time to look into it in more detail. |
mcollina
commented
Sep 29, 2016
They lifted some code from core back then. Not sure exactly why, so feel free to have a look, you might also want to send them a PR. You can just run any Express app with DEBUG=* and redirect the output to a file, if that works, we are grand with this. LGTM |
addaleax
commented
Sep 29, 2016
I’ll try that later then. :) |
@addaleax ... +1 to exploring if we can fixup instanceof with Duplex separately. |
addaleax
commented
Sep 30, 2016
Just in case you haven’t seen it, that would be #8834. :) |
jasnell
commented
Sep 30, 2016
ha! yeah, hadn't made it that far through the notifications ;-) |
Fishrock123
commented
Sep 30, 2016
Again, doubtful. My experience so far is that people become confused when stdio is suddenly not sockets when dealing with files. |
mcollina
commented
Oct 1, 2016
I agree with you @Fishrock123. This PR improve things anyway. |
addaleax
commented
Oct 8, 2016
I’d like to land this on Monday if there are no objections; we can still talk about making |
Make the internal `SyncWriteStream` a proper `stream.Writable` subclass. This allows for quite a bit of simplification, since `SyncWriteStream` predates the streams2/streams3 implementations. Fixes: nodejs#8828 PR-URL: nodejs#8830 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
addaleax
commented
Oct 10, 2016
Landed in a60f607 |
Make the internal `SyncWriteStream` a proper `stream.Writable` subclass. This allows for quite a bit of simplification, since `SyncWriteStream` predates the streams2/streams3 implementations. Fixes: #8828 PR-URL: #8830 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Fishrock123
commented
Oct 11, 2016
@addaleax requires internals... think you could backport? |
addaleax
commented
Oct 11, 2016
@Fishrock123 will do :) |
Make the internal `SyncWriteStream` a proper `stream.Writable` subclass. This allows for quite a bit of simplification, since `SyncWriteStream` predates the streams2/streams3 implementations. Fixes: nodejs#8828 PR-URL: nodejs#8830 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Make the internal `SyncWriteStream` a proper `stream.Writable` subclass. This allows for quite a bit of simplification, since `SyncWriteStream` predates the streams2/streams3 implementations. Fixes: #8828 PR-URL: #8830 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> (backport info) Refs: #9030
* fs: - `SyncWriteStream` now inherits from `Stream.Writable`. (Anna Henningsen) #8830 - Practically, this means that when stdio is piped to a file, stdout and stderr will still be `Writable` streams. - `fs.existsSync()` has been undeprecated. `fs.exists()` remains deprecated. (Dan Fabulich) #8364 * http: `http.request()` now accepts a `timeout` option. (Rene Weber) #8101 * module: The module loader now maintains its own realpath cache. (Anna Henningsen) #8100 * npm: Upgraded to 3.10.8 (Kat Marchán) #8706 * stream: `Duplex` streams now show proper `instanceof Stream.Writable`. (Anna Henningsen) #8834 * timers: Improved `setTimeout`/`Interval` performance by up to 22%. (Brian White) #8661 PR-URL: #9034
* fs: - `SyncWriteStream` now inherits from `Stream.Writable`. (Anna Henningsen) #8830 - Practically, this means that when stdio is piped to a file, stdout and stderr will still be `Writable` streams. - `fs.existsSync()` has been undeprecated. `fs.exists()` remains deprecated. (Dan Fabulich) #8364 * http: `http.request()` now accepts a `timeout` option. (Rene Weber) #8101 * module: The module loader now maintains its own realpath cache. (Anna Henningsen) #8100 * npm: Upgraded to 3.10.8 (Kat Marchán) #8706 * stream: `Duplex` streams now show proper `instanceof Stream.Writable`. (Anna Henningsen) #8834 * timers: Improved `setTimeout`/`Interval` performance by up to 22%. (Brian White) #8661 PR-URL: #9034
* fs: - `SyncWriteStream` now inherits from `Stream.Writable`. (Anna Henningsen) nodejs/node#8830 - Practically, this means that when stdio is piped to a file, stdout and stderr will still be `Writable` streams. - `fs.existsSync()` has been undeprecated. `fs.exists()` remains deprecated. (Dan Fabulich) nodejs/node#8364 * http: `http.request()` now accepts a `timeout` option. (Rene Weber) nodejs/node#8101 * module: The module loader now maintains its own realpath cache. (Anna Henningsen) nodejs/node#8100 * npm: Upgraded to 3.10.8 (Kat Marchan) nodejs/node#8706 * stream: `Duplex` streams now show proper `instanceof Stream.Writable`. (Anna Henningsen) nodejs/node#8834 * timers: Improved `setTimeout`/`Interval` performance by up to 22%. (Brian White) nodejs/node#8661 Signed-off-by: Ilkka Myller <ilkka.myller@nodefield.com>
* fs: - `SyncWriteStream` now inherits from `Stream.Writable`. (Anna Henningsen) nodejs/node#8830 - Practically, this means that when stdio is piped to a file, stdout and stderr will still be `Writable` streams. - `fs.existsSync()` has been undeprecated. `fs.exists()` remains deprecated. (Dan Fabulich) nodejs/node#8364 * http: `http.request()` now accepts a `timeout` option. (Rene Weber) nodejs/node#8101 * module: The module loader now maintains its own realpath cache. (Anna Henningsen) nodejs/node#8100 * npm: Upgraded to 3.10.8 (Kat Marchan) nodejs/node#8706 * stream: `Duplex` streams now show proper `instanceof Stream.Writable`. (Anna Henningsen) nodejs/node#8834 * timers: Improved `setTimeout`/`Interval` performance by up to 22%. (Brian White) nodejs/node#8661 Signed-off-by: Ilkka Myller <ilkka.myller@nodefield.com>
Checklist
make -j8 test(UNIX), orvcbuild test nosign(Windows) passesAffected core subsystem(s)
fs, process?
Description of change
Make the internal
SyncWriteStreama properstream.Writablesubclass. This allows for quite a bit of simplification, sinceSyncWriteStreampredates the streams2/streams3 implementations.Fixes: #8828
I’ve tried to be conservative with the changes here, e.g. by keeping the explicit
readableboolean property and by keeping the.destroy()behaviour of emitting an explicitcloseevent, although I doubt that either of these are relied upon.