Skip to content

DrewCarlson/ksubprocess

 
 

Repository files navigation

ksubprocess

Maven Central Sonatype Nexus (Snapshots)

Kotlin multiplatform library for launching child processes, monitoring their state, and capturing output.

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)

Supported platforms

Ksubprocess supports the following platforms:

  • JVM via java.lang.Process
  • Native/Linux via fork/exec
  • Native/Windows via CreateProcess
  • Native/macOS via NSTask

Download

Maven Central Sonatype Nexus (Snapshots)

repositories {
    mavenCentral()
    // Or snapshots
    maven("https://s01.oss.sonatype.org/content/repositories/snapshots/")
}

dependencies {
    implementation("org.drewcarlson:ksubprocess:$VERSION")
}

About

Kotlin multiplatform library for managing subprocesses.

Resources

License

Stars

Watchers

Forks

Languages

  • Kotlin 100.0%