Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/internal/streams/readable.js
Original file line number Diff line number Diff line change
Expand Up @@ -1166,8 +1166,8 @@ ObjectDefineProperties(Readable.prototype, {
// where the readable side was disabled upon construction.
// Compat. The user might manually disable readable side through
// deprecated setter.
return !!r && r.readable !== false && !r.destroyed && !r.errorEmitted &&
!r.endEmitted;
if (!r || r.readable === false) return;
return !r.destroyed && !r.errorEmitted && !r.endEmitted;
},
set(val) {
// Backwards compat.
Expand Down
4 changes: 2 additions & 2 deletions lib/internal/streams/writable.js
Original file line number Diff line number Diff line change
Expand Up @@ -793,8 +793,8 @@ ObjectDefineProperties(Writable.prototype, {
// where the writable side was disabled upon construction.
// Compat. The user might manually disable writable side through
// deprecated setter.
return !!w && w.writable !== false && !w.destroyed && !w.errored &&
!w.ending && !w.ended;
if (!w || w.writable === false) return;
return !w.destroyed && !w.errored && !w.ending && !w.ended;
},
set(val) {
// Backwards compatible.
Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-stream-compose.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,8 @@ const assert = require('assert');
}
});

assert.strictEqual(s1.writable, false);
assert.strictEqual(s1.readable, false);
assert.strictEqual(s1.writable, undefined);
assert.strictEqual(s1.readable, undefined);

finished(s1.resume(), common.mustCall((err) => {
assert(!err);
Expand Down
10 changes: 5 additions & 5 deletions test/parallel/test-stream-duplex-from.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const { Duplex, Readable, Writable, pipeline } = require('stream');
})
});
assert.strictEqual(d.readable, true);
assert.strictEqual(d.writable, false);
assert.strictEqual(d.writable, undefined);
d.once('readable', common.mustCall(function() {
assert.strictEqual(d.read().toString(), 'asd');
}));
Expand All @@ -31,7 +31,7 @@ const { Duplex, Readable, Writable, pipeline } = require('stream');
}
}));
assert.strictEqual(d.readable, true);
assert.strictEqual(d.writable, false);
assert.strictEqual(d.writable, undefined);
d.once('readable', common.mustCall(function() {
assert.strictEqual(d.read().toString(), 'asd');
}));
Expand All @@ -48,7 +48,7 @@ const { Duplex, Readable, Writable, pipeline } = require('stream');
callback();
}
}));
assert.strictEqual(d.readable, false);
assert.strictEqual(d.readable, undefined);
assert.strictEqual(d.writable, true);
d.end('asd');
d.on('finish', common.mustCall(function() {
Expand All @@ -67,7 +67,7 @@ const { Duplex, Readable, Writable, pipeline } = require('stream');
}
})
});
assert.strictEqual(d.readable, false);
assert.strictEqual(d.readable, undefined);
assert.strictEqual(d.writable, true);
d.end('asd');
d.on('finish', common.mustCall(function() {
Expand Down Expand Up @@ -110,7 +110,7 @@ const { Duplex, Readable, Writable, pipeline } = require('stream');
{
const d = Duplex.from(Promise.resolve('asd'));
assert.strictEqual(d.readable, true);
assert.strictEqual(d.writable, false);
assert.strictEqual(d.writable, undefined);
d.once('readable', common.mustCall(function() {
assert.strictEqual(d.read().toString(), 'asd');
}));
Expand Down
6 changes: 3 additions & 3 deletions test/parallel/test-stream-duplex-readable-writable.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const assert = require('assert');
const duplex = new Duplex({
readable: false
});
assert.strictEqual(duplex.readable, false);
assert.strictEqual(duplex.readable, undefined);
duplex.push('asd');
duplex.on('error', common.mustCall((err) => {
assert.strictEqual(err.code, 'ERR_STREAM_PUSH_AFTER_EOF');
Expand All @@ -22,7 +22,7 @@ const assert = require('assert');
writable: false,
write: common.mustNotCall()
});
assert.strictEqual(duplex.writable, false);
assert.strictEqual(duplex.writable, undefined);
duplex.write('asd');
duplex.on('error', common.mustCall((err) => {
assert.strictEqual(err.code, 'ERR_STREAM_WRITE_AFTER_END');
Expand All @@ -34,7 +34,7 @@ const assert = require('assert');
const duplex = new Duplex({
readable: false
});
assert.strictEqual(duplex.readable, false);
assert.strictEqual(duplex.readable, undefined);
duplex.on('data', common.mustNotCall());
duplex.on('end', common.mustNotCall());
async function run() {
Expand Down