is there a way to run generated kexe file from Int...
# kotlin-native
r
is there a way to run generated kexe file from IntelliJ Idea?
Copy code
fun main() {
    val numbers = readLine()?.split(',')?.map {
        it.toInt()
    }
    println(numbers?.sum()?:"No Numbers")
}
I have written this code that takes input. When I run from terminal
./file.kexe
it works fine. But I want to create run configuration for running generated kexe file
which would take input also
like it does with
./file.kexe
a
There should be a Gradle task in "run" group
r
There is . But it doesnt wait for taking input
g
you can build and run manually, without task, using custom run config (for command line)
r
I want to configure task for this actually. I am able to build and run manually. But want configure a task. Just hit play button and program works
i
The default run task is just an
Exec
task so you can override the input stream as described at https://docs.gradle.org/current/dsl/org.gradle.api.tasks.Exec.html The configuration will be the following (Kotlin DSL):
Copy code
kotlin {
    macosX64("macos") {
        binaries {
            executable {
                runTask?.standardInput = System.`in`
            }
        }
    }
}
You also may need to run gradle in a quiet mode to avoid interfering between outputs of Gradle and your program, e.g.
./gradlew :runDebugExecutableMacos --console=plain -q