Open kitsonk opened 4 years ago
https://github.com/libuv/libuv/issues/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.
@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).
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.
@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.
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.
Subprocess API design has been updated to Deno.Command
in https://github.com/denoland/deno/pull/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;
}
Another note: We have our own pty implementation in test_util/src/pty.rs
In std, we landed promptSecret
, but it's only tested manually by contributors. I think we are now strongly in need of this feature.
FYI, linking a reference to currently in-use rust support code for Deno tests utilizing a PTY ... https://github.com/denoland/deno/blob/2de4faa483982478e9a36ad4ab891a887b4779f1/tests/util/server/src/pty.rs.
It might be useful as a reference if/when this gains some forward momentum.
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