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

Support a pty interface #3994

Open
kitsonk opened this issue Feb 14, 2020 · 8 comments
Open

Support a pty interface #3994

kitsonk opened this issue Feb 14, 2020 · 8 comments
Labels
cli related to cli/ dir help wanted community help requested suggestion suggestions for new features (yet to be agreed)

Comments

@kitsonk
Copy link
Contributor

kitsonk commented Feb 14, 2020

Deno should support forking of pty interfaces (psuedo terminals) which would allow Deno workloads to be able to "pretend" to be a terminal, which can allow Deno workloads to be a terminal emulator or allow certain programs to think a Deno workload is an terminal to send it control sequences.

Node.js Prior art: https://github.com/microsoft/node-pty (which is used to provide the terminal interface in VSCode)
Likely this crate can be used: https://docs.rs/portable-pty/0.2.0/portable_pty/ which provides Linux/Mac and Windows support.

cc/ @Lerc

@bnoordhuis
Copy link
Contributor

libuv/libuv#2640 might be instructive. Notably, pty emulation on Windows < 10 is highly arcane - it involves setting up a console, positioning it off-screen and scraping it with an agent process. Yes.

The crate you link to offloads that to winpty but it requires that winpty.dll be installed separately. Not a great out-of-the-box experience.

@kitsonk
Copy link
Contributor Author

kitsonk commented Feb 14, 2020

@bnoordhuis actually it uses conpty which is included in Windows 10+, it is only pre-Windows 10 where winpty is required (just like node-pty).

@bnoordhuis
Copy link
Contributor

That's what I said, didn't I? Windows < 10.

As a data point: Windows 7 + 8 still makes up 55% of Node's Windows user base, if I read the download stats right.

@musm
Copy link

musm commented Jul 16, 2020

@bnoordhuis Is that really the percentage? So 55% of Deno''s Windows user base is using an unsupported OS that has stopped receiving technical support for any issues, software updates, and security updates or fixes? That's a bit unsettling.

IMO it makes no sense to keep supporting Windows 7-8 when MSFT itself has dropped support. Using conpty for child processes would help alleviate several important issues in my case when launching child processes.

@stale
Copy link

stale bot commented Feb 17, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Feb 17, 2021
@kitsonk kitsonk added the suggestion suggestions for new features (yet to be agreed) label Feb 17, 2021
@stale stale bot removed the stale label Feb 17, 2021
@kitsonk kitsonk added the cli related to cli/ dir label Feb 17, 2021
@kt3k
Copy link
Member

kt3k commented Nov 29, 2023

Subprocess API design has been updated to Deno.Command in #17628

Probably the API design should be like:

export class Command {
  ...
  spawnPty(options: SpawnPtyOptions): PtyChildProcess;
}

interface ConsoleSize {
  columns: number;
  rows: number;
}

interface SpawnPtyOptions extends ConsoleSize {}

export class PtyChildProcess extends ChildProcess {
  consoleSize(): ConsoleSize;
  resize(size: ConsoleSize): void;
}

@kt3k
Copy link
Member

kt3k commented Nov 30, 2023

Another note: We have our own pty implementation in test_util/src/pty.rs

@kt3k
Copy link
Member

kt3k commented Nov 30, 2023

In std, we landed promptSecret, but it's only tested manually by contributors. I think we are now strongly in need of this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli related to cli/ dir help wanted community help requested suggestion suggestions for new features (yet to be agreed)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants