Skip to content
This repository has been archived by the owner on Dec 7, 2019. It is now read-only.

Commit

Permalink
Run command as is in Windows even with unbuffered mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitry Yunitsky committed Feb 25, 2018
1 parent b04853c commit 7d9a577
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions os/src/main/kotlin/com/gojuno/commander/os/Processes.kt
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ fun process(

val command: List<String>

when (unbufferedOutput) {
false -> command = commandAndArgs
true -> command = when (os()) {
command = when (unbufferedOutput) {
false -> commandAndArgs
true -> when (os()) {
// Some programs, in particular "emulator" do not always flush output
// after printing so we have to force unbuffered mode to make sure
// that output will be available for consuming.
Linux -> listOf("script", outputFile.absolutePath, "--flush", "-c", commandAndArgs.joinToString(separator = " "))
Mac -> listOf("script", "-F", outputFile.absolutePath, *commandAndArgs.toTypedArray())
Windows -> throw IllegalStateException("Unbuffered output is not supported on Windows")
Windows -> commandAndArgs
}
}

Expand Down

0 comments on commit 7d9a577

Please sign in to comment.