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

Node parity: process.stdin.ref is undefined #16718

Closed
ctjlewis opened this issue Jan 24, 2025 · 4 comments · Fixed by #16767
Closed

Node parity: process.stdin.ref is undefined #16718

ctjlewis opened this issue Jan 24, 2025 · 4 comments · Fixed by #16767
Labels
bug Something isn't working confirmed bug We can reproduce this issue node:process regression

Comments

@ctjlewis
Copy link

ctjlewis commented Jan 24, 2025

What version of Bun is running?

1.2.0-canary.15+8f821b791

What platform is your computer?

Darwin 24.2.0 arm64 arm

What steps can reproduce the bug?

$ bun repl

> process.stdin.ref
undefined
$ node

> process.stdin.ref
[Function (anonymous)]

What is the expected behavior?

process.stdin.ref() is meant to provide a reference to this stream.

$ node
> process.stdin === process.stdin.ref()
true

It's used in libraries like ink, which used to work for Bun but now breaks on latest (release and canary).

What do you see instead?

process.stdin.ref is undefined.

Related

@ctjlewis ctjlewis added bug Something isn't working needs triage labels Jan 24, 2025
@ctjlewis ctjlewis changed the title process.stdin.ref is undefined Node parity: process.stdin.ref is undefined Jan 25, 2025
@ctjlewis
Copy link
Author

ctjlewis commented Jan 25, 2025

Thank you @pfgithub and @RiskyMH for triage, good labels, sorry I forgot those.

@RiskyMH
Copy link
Member

RiskyMH commented Jan 25, 2025

Interesting, in 1.1.45 it was a function (compared to undefined now) but the check evaluated to false

Edit: process.stdin.ref() on 1.1.45 simply returns undefined, but at least its a function

@RiskyMH RiskyMH added the confirmed bug We can reproduce this issue label Jan 25, 2025
@RiskyMH RiskyMH marked this as a duplicate of #16678 Jan 25, 2025
@ctjlewis
Copy link
Author

Interesting, in 1.1.45 it was a function (compared to undefined now) but the check evaluated to false

I think I felt the effects of that before without knowing what was going on. We had to manually resume the stream at the top of the program with process.stdin.resume(), that and other things might have been related.

Jarred-Sumner added a commit that referenced this issue Jan 26, 2025
Jarred-Sumner added a commit that referenced this issue Jan 26, 2025
@ctjlewis
Copy link
Author

Based, awesome job @Jarred-Sumner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working confirmed bug We can reproduce this issue node:process regression
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants