jakubriegel / kotlin-shell

Tool for performing shell-like programing in Kotlin
Apache License 2.0
143 stars 8 forks source link

How can I get the output of a command? #25

Closed elect86 closed 3 years ago

elect86 commented 3 years ago

As titled, sorry if this may sound dumb, but I'm looking at parsing manually specific commands outputs.

jakubriegel commented 3 years ago

Hi! Look like related to #21

elect86 commented 3 years ago

Something like this?

    val out = ByteArrayOutputStream()
    pipeline { "ls".process() pipe out }
    println(out)

Can I be sure there won't be any race condition because of the Coroutine? Is there a simpler way?

jakubriegel commented 3 years ago

It will work fine and it is the only supported way