Kotlin Native library for create sub-process and redirect their I/O.
Rust is an excellent language that takes into account both performance and engineering.
In version 1.x, we use the following API to provide the function of creating child processes
forkof [POSIX api]CreateChildProcessof [win32 api]java.lang.ProcessBuilderof JVM
In version 2.x, we use the Rust standard library to provide the function of creating child processes.
std::process::Commandof Rustjava.lang.ProcessBuilderof JVM
It will bring
- More unified API
- Easier to use API
- Performance is still excellent
- Easier to maintain
- Code structure is clearer
- x86_64-apple-darwin
- aarch64-apple-darwin
- x86_64-unknown-linux-gnu
- aarch64-unknown-linux-gnu
- x86_64-pc-windows-gnu (mingw-w64)
- jvm
- Rust Standard Library 1.83.0
- Kotlin Multiplatform 2.1.0
build.gradle.kts:
// ……
repositories {
mavenCentral()
}
// ……
dependencies {
// should replace with the latest version
implementation("com.kgit2:kommand:2.x")
}
Full example check kommand-examples/timeout.
Dependency:
requiredkotlinx-coroutines
- rust toolchain - 1.83.0 (https://rustup.rs)
- just (install with
cargo install just)
- just (install with
- cross-compile toolchain
- x86_64-apple-darwin
- aarch64-apple-darwin
- x86_64-unknown-linux-gnu
- aarch64-unknown-linux-gnu
- x86_64-pc-windows-gnu (mingw-w64)
- docker (optional)
Recommend build all platforms in macOS.
Kotlin Multiplatform gets the most complete support on macOS.
If you are using macOS, you can install the cross-compile toolchain with
just prepareOtherwise, you need to install the cross-compile toolchain yourself.
git clone https://github.com/kgit2/kommand.gitcd kommand-core
just all./gradlew buildOnly linux support cross-platform test.
- install docker
- test it
# for x86_64
just linuxX64Test
# for aarch64
just linuxArm64Test@XJMiada.(Original Picture)
Apache2.0 © BppleMan
