
Launches child processes, monitors state, and captures output. Supports command-line arguments, input redirection, error checking, and multiple platforms, offering comprehensive process management.
Kotlin multiplatform library for launching child processes, monitoring their state, and capturing output. Built with kotlinx.coroutines and kotlinx.io.
val result = exec {
// some command line program
arg("curl")
args("-d", "@-")
arg("https://my.api")
// redirect streams
stdin = Redirect.Pipe
stdout = Redirect.Pipe
stderr = Redirect.Write("/log/file")
// pipe input data to stdin
input {
append("Hello, World")
}
// check for errors
check = true
}
// use result
println(result.output)Ksubprocess supports the following platforms:
java.lang.Process
fork/exec
CreateProcess
NSTask
repositories {
mavenCentral()
// Or snapshots
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/")
}
dependencies {
implementation("org.drewcarlson:ksubprocess:$VERSION")
}Kotlin multiplatform library for launching child processes, monitoring their state, and capturing output. Built with kotlinx.coroutines and kotlinx.io.
val result = exec {
// some command line program
arg("curl")
args("-d", "@-")
arg("https://my.api")
// redirect streams
stdin = Redirect.Pipe
stdout = Redirect.Pipe
stderr = Redirect.Write("/log/file")
// pipe input data to stdin
input {
append("Hello, World")
}
// check for errors
check = true
}
// use result
println(result.output)Ksubprocess supports the following platforms:
java.lang.Process
fork/exec
CreateProcess
NSTask
repositories {
mavenCentral()
// Or snapshots
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/")
}
dependencies {
implementation("org.drewcarlson:ksubprocess:$VERSION")
}