commander icon indicating copy to clipboard operation
commander copied to clipboard

Why you decided to use `script` and get all output through file?

Open dimorinny opened this issue 7 years ago • 1 comments

I would like to ask this question because we found strange things with this part of commander.

script have a different behaviour depends on version. For example, script from unix-utils 2.27.1 saves placeholder about started time like this:

Script started on Tue 24 Apr 2018 04:22:21 AM MSK

even we have --quiet flag.

Also, we had a flaky experience with composer, that uses this implementation of commander and getting output from the command using tail.

We fixed this using common approach for running subprocesses.

But now it has a little bit different interface, then current implementation. For example, Notification class looks like this for supporting real-time output parsing (instead of tail):

sealed class Notification {
    object Start : Notification()
    data class Exit(val output: String) : Notification()
    data class Output(val line: String) : Notification()
}

Would you like to have this changes in commander or it is important to have current behaviour or you don't want to merge breaking changes?

dimorinny avatar Apr 24 '18 01:04 dimorinny

Main reason to use script was the problem with output buffering.

For example when adb or emulator print really short output that doesn't overflow buffer we couldn't read it.

Few weeks I've been trying to solve this problem one way or another using Java piping api, but script -F was the only approach that worked in all test cases on all OSes.

I'm open to see how you solved it if you can submit a PR that would be great!

Commander is pre-v1, so we can introduce breaking changes, or we can also release a v1.

artem-zinnatullin avatar Apr 24 '18 17:04 artem-zinnatullin