Join Slack
How do I pass a series of program arguments to the posix_spawn function ( <https://man7.org/linux/ma...
# 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.
16
Views
Open in Slack
Previous
Next
kotlinlang
A modern programming language that makes developers happier.
Powered by