Open ExE-Boss opened 5 months ago
Afaik, there's no wintpy use in jline.
Having said that I was meant to ask @gnodet what it'd look like to add pty process support into jline? There is pty4j(uses conpty with fallback to winpty) from JetBrains but it has its own issues making it difficult to rely on.
It'd be quite nice feature to run external command with pty from jline based app. Something I've been looking to support in spring-shell
but it feels a wrong place for code like this.
We could start by implementing these via ffm(jvm22+) and then look if there's any interest for supporting older jvm's via jni.
Afaik, there's no wintpy use in jline.
Right. When running in a windows console, JLine access the windows api to control it.
Having said that I was meant to ask @gnodet what it'd look like to add pty process support into jline? There is pty4j(uses conpty with fallback to winpty) from JetBrains but it has its own issues making it difficult to rely on.
It'd be quite nice feature to run external command with pty from jline based app. Something I've been looking to support in
spring-shell
but it feels a wrong place for code like this.We could start by implementing these via ffm(jvm22+) and then look if there's any interest for supporting older jvm's via jni.
I'm not completely sure what you'd want to achieve here. For example, you have a JLine based app running in a console, and you want to launch a bash
shell using the current terminal ? Or you want to create a pseudo terminal using JLine and then fork/exec a native process in it ?
The first part is already doable afaik. The second part is missing the fork/tcsetsid/execve
call, as opening a pseudo terminal can already be done.
Yeah fork/execve
, at least on linux, was what I meant. In a perfect world jdk's ProcessBuilder
would do this, pty4j
is trying to have pty features as extension named PtyProcessBuilder
.
Yeah
fork/execve
, at least on linux, was what I meant. In a perfect world jdk'sProcessBuilder
would do this,pty4j
is trying to have pty features as extension namedPtyProcessBuilder
.
Ok. I think JLine could be a good location for this feature. Out of curiosity, what usage do you foresee for it ? The two implementations seem to come from Intelij IDEA and Eclipse so that they can run real terminals/shells inside the IDE. JLine is more oriented toward console mode application, so it's more unusual to spawn another terminal.
As of Windows 10, Windows now has the ConPTY API, which behaves similarly to the POSIX PTY APIs, making it possible to use real pseudoconsoles on Windows, without needing to use hacks like WinPTY, which spawn a hidden conhost session off‑screen and scrape its output.
Refs: