Skip to content

Latest commit

 

History

History
69 lines (54 loc) · 2.34 KB

README.md

File metadata and controls

69 lines (54 loc) · 2.34 KB

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")
}