Here is a simple script
fun main() {
print("ready> ")
val input = readLine()
println("User input: $input")
}
When I run this program with gradle runReleaseExecutableMacos
I expect that I'll see a ready>
prompt and will have a possibility to type some chars. But this program finishes immediately with User input: null
as a result.
Am I missing something?
To achieve the behavior you desire, you can run the executable file produced by the Gradle. It will have an extension *.kexe
.
Also, you can extend your build.gradle
file with additional parameter. you got to add something like this:
macosX64("macos") {
binaries {
executable {
runTask.standardInput = System.in
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With