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(ext/node): use tty stdin from ext/io #23044

Merged
merged 1 commit into from
Mar 28, 2024

Conversation

littledivy
Copy link
Member

@littledivy littledivy commented Mar 23, 2024

Fixes #23043 #23107

@littledivy littledivy enabled auto-merge (squash) March 23, 2024 06:01
Copy link
Member

@satyarohith satyarohith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A small test would be great!

@birkskyum birkskyum mentioned this pull request Mar 24, 2024
@littledivy
Copy link
Member Author

littledivy commented Mar 26, 2024

I'm not sure how to trigger the bug. Deno.stdin is not initialized before bootstrap. Somehow the tty ReadStream constructor is called before stdin is initialized in Node compat mode.

This test is passing on main

import * as process from 'node:process';

const { stdin } = process;
stdin.setRawMode(true);
stdin.resume();
stdin.setEncoding('utf8');
stdin.on('data', (key) => {
  if (key === '\u0003') {
    // Ctrl+C
    process.exit();
  }
  process.stdout.write(key);
});

Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Divy added a smoke test in a separate repo

@littledivy littledivy merged commit de0b230 into denoland:main Mar 28, 2024
17 checks passed
@littledivy littledivy deleted the node_tty_io_stdin branch March 28, 2024 03:26
littledivy added a commit to littledivy/deno that referenced this pull request Apr 13, 2024
This is the same issue as denoland#23044
but in `WriteStream`.

Adding a docusarus test in npm_smoke_tests repo
littledivy added a commit that referenced this pull request Apr 13, 2024
This is the same issue as #23044
but in `WriteStream`.

Adding a docusarus test in npm_smoke_tests repo.
bartlomieju pushed a commit that referenced this pull request Apr 15, 2024
This is the same issue as #23044
but in `WriteStream`.

Adding a docusarus test in npm_smoke_tests repo.
littledivy added a commit to littledivy/deno that referenced this pull request Apr 19, 2024
This is the same issue as denoland#23044
but in `WriteStream`.

Adding a docusarus test in npm_smoke_tests repo.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

node:tty Cannot read properties of undefined (reading 'Symbol(Deno.internal.rid)')
3 participants