let it roll, let it crash down low

This commit is contained in:
snwy
2024-11-01 21:15:51 -07:00
parent a35c5d0b89
commit e8fd3a37ad
5 changed files with 11 additions and 7 deletions

View File

@@ -29,8 +29,7 @@ function getGetter(cls, getter) {
}
function uncurryThis(func) {
// Intrinsics do not have `call` as a valid identifier, so this cannot be `Function.prototype.call.bind`.
return FunctionPrototypeCall.bind(func);
return (...args) => func.$call(...args);
}
const copyProps = (src, dest) => {

View File

@@ -127,10 +127,10 @@ function eos(stream, options, callback) {
}
if (readable && !readableFinished && isReadableNodeStream(stream, true)) {
if (!isReadableFinished(stream, false)) return callback.$call(stream, $ERR_STREAM_PREMATURE_CLOSE());
if (!isReadableFinished(stream, false)) return callback.$call(stream, $ERR_STREAM_PREMATURE_CLOSE("readable"));
}
if (writable && !writableFinished) {
if (!isWritableFinished(stream, false)) return callback.$call(stream, $ERR_STREAM_PREMATURE_CLOSE());
if (!isWritableFinished(stream, false)) return callback.$call(stream, $ERR_STREAM_PREMATURE_CLOSE("writable"));
}
callback.$call(stream);

View File

@@ -219,7 +219,6 @@ function pipelineImpl(streams, callback, opts) {
}
function finishImpl(err, final) {
console.trace("finishImpl", err, final);
if (err && (!error || error.code === "ERR_STREAM_PREMATURE_CLOSE")) {
error = err;
}
@@ -296,6 +295,7 @@ function pipelineImpl(streams, callback, opts) {
if (isTransformStream(ret)) {
ret = makeAsyncIterable(ret?.readable);
} else {
// AAAA FUCK AAAAAAA
ret = makeAsyncIterable(ret);
}
ret = stream(ret, { signal });

View File

@@ -568,8 +568,12 @@ Readable.prototype.setEncoding = function (enc) {
const decoder = new StringDecoder(enc);
state.decoder = decoder;
// If setEncoding(null), decoder.encoding equals utf8.
state.encoding = state.decoder.encoding;
if (enc == null) {
state.encoding = "utf8";
} else {
state.encoding = state.decoder.encoding;
}
// Iterate over current buffer to convert already stored Buffers:
let content = "";

View File

@@ -30,6 +30,7 @@ const Duplex = require("../streams/duplex");
const kEmptyObject = Object.freeze({ __proto__: null });
const { destroy } = require("../streams/destroy");
function handleKnownInternalErrors(cause) {
switch (true) {