Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: stuff i forgot to push #7651

Merged
merged 2 commits into from
Dec 14, 2023
Merged
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
8 changes: 2 additions & 6 deletions src/bun.js/bindings/bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4658,10 +4658,8 @@ void JSC__JSValue__forEachProperty(JSC__JSValue JSValue0, JSC__JSGlobalObject* g

bool isPrivate = prop->isSymbol() && Identifier::fromUid(vm, prop).isPrivateName();

#if !BUN_DEBUG
if (isPrivate)
if (isPrivate && !JSC::Options::showPrivateScriptsInStackTraces())
return true;
#endif

iter(globalObject, arg2, &key, JSC::JSValue::encode(propertyValue), prop->isSymbol(), isPrivate);
return true;
Expand Down Expand Up @@ -4754,10 +4752,8 @@ void JSC__JSValue__forEachProperty(JSC__JSValue JSValue0, JSC__JSGlobalObject* g

bool isPrivate = property.isPrivateName();

#if !BUN_DEBUG
if (isPrivate)
if (isPrivate && !JSC::Options::showPrivateScriptsInStackTraces())
continue;
#endif

iter(globalObject, arg2, &key, JSC::JSValue::encode(propertyValue), property.isSymbol(), isPrivate);
}
Expand Down
18 changes: 17 additions & 1 deletion src/js/builtins/ProcessObjectInternals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export function getStdinStream(fd) {
// Ideally we could use this:
// return require("node:stream")[Symbol.for("::bunternal::")]._ReadableFromWeb(Bun.stdin.stream());
// but we need to extend TTY/FS ReadStream
const native = Bun.stdin.stream();

var reader: ReadableStreamDefaultReader<Uint8Array> | undefined;
var readerRef;
Expand All @@ -78,7 +79,7 @@ export function getStdinStream(fd) {

function ref() {
$debug("ref();", reader ? "already has reader" : "getting reader");
reader ??= Bun.stdin.stream().getReader();
reader ??= native.getReader();
// TODO: remove this. likely we are dereferencing the stream
// when there is still more data to be read.
readerRef ??= setInterval(() => {}, 1 << 30);
Expand All @@ -104,6 +105,21 @@ export function getStdinStream(fd) {
// Releasing the lock is not possible as there are active reads
// we will instead pretend we are unref'd, and release the lock once the reads are finished.
shouldUnref = true;

// unref the native part of the stream
try {
$getByIdDirectPrivate(
$getByIdDirectPrivate(native, "readableStreamController"),
"underlyingByteSource",
).$resume(false);
} catch (e) {
if (IS_BUN_DEVELOPMENT) {
// we assume this isn't possible, but because we aren't sure
// we will ignore if error during release, but make a big deal in debug
console.error(e);
$assert(!"reachable");
}
}
}
}
}
Expand Down
1 change: 0 additions & 1 deletion src/js/builtins/ReadableStreamInternals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1490,7 +1490,6 @@ export function readableStreamReaderGenericRelease(reader) {

var stream = $getByIdDirectPrivate(reader, "ownerReadableStream");
if ($getByIdDirectPrivate(stream, "bunNativeType") != 0) {
$debug(stream);
$getByIdDirectPrivate($getByIdDirectPrivate(stream, "readableStreamController"), "underlyingByteSource").$resume(
false,
);
Expand Down