Join Slack
how can I start a bash shell then while making use of kotlin coroutines send commands to it and get ...
# getting-started
z
zt
02/07/2023, 6:52 AM
how can I start a bash shell then while making use of kotlin coroutines send commands to it and get the stdout?
e
ephemient
02/07/2023, 7:14 AM
on JVM? this isn't something that the underlying Java platform provides good APIs for
ephemient
02/07/2023, 7:15 AM
you could use
ProcessBuilder
and read/write its pipes, but a. that's blocking and b. it won't act like it's in a terminal
ephemient
02/07/2023, 7:19 AM
IntelliJ uses
https://github.com/JetBrains/pty4j
to wrap native code which is able to interact with terminal APIs
ephemient
02/07/2023, 7:20 AM
if you just want to run commands and get their output individually though, there's no need for any of that. just use a
ProcessBuilder
for each
z
zt
02/07/2023, 7:27 AM
I see, thank you
3
Views
Open in Slack
Previous
Next
kotlinlang
A modern programming language that makes developers happier.
Powered by