Join Slack
Powered by
How do I pass a series of program arguments to the...
# kotlin-native
n
napperley
06/04/2022, 12:48 AM
How do I pass a series of program arguments to the
posix_spawn
function (
https://man7.org/linux/man-pages/man3/posix_spawn.3.html
; using
argv
parameter )? I have tried the
toCStringArray
function (
https://kotlinlang.org/api/latest/jvm/stdlib/kotlinx.cinterop/to-c-string-array.html
) trick but that isn't working as expected. Reading from the child process's output stream results in an infinite loop occurring. The child process is a Kotlin Native program that prints out the program arguments (via
stdout
).
napperley
06/04/2022, 10:41 PM
Turns out the absolute path to the program needs to be the first element in the array, otherwise strange behaviour will occur when spawning the process.
17
Views
Open in Slack
Previous
Next