cross-exec 0.1.1

⚡️ Unix CommandExt::exec but isomorphic
Documentation
  • Coverage
  • 50%
    2 out of 4 items documented0 out of 2 items with examples
  • Size
  • Source code size: 12.64 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 823.75 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 19s Average build duration of successful builds.
  • all releases: 20s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • jcbhmr/cross-exec-rs
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • jcbhmr

Cross-platform exec for Rust

⚡️ Unix CommandExt::exec but isomorphic

Command::new("cargo")
  .arg("--version")
  .cross_exec()

🟦 Emulates process replacement behaviour on Windows
🐧 Uses native CommandExt::exec on Unix

Installation

Rust

cargo add cross-exec

Usage

Rust

Use .cross_exec() on a std::process::Command just like you would use .exec() on Unix.

use cross_exec::CommandExt;
use std::process::Command;
use std::error::Error;

fn main() -> Result<(), Box<dyn Error>> {
  let err = Command::new("cargo")
    .arg("--version")
    .cross_exec();
  Err(err.into())
}

Development

Rust

Why?
I wanted a cross-platform way to replace the current process with a new one for wrapper programs that just end up calling another program at the end.

This project is based on the exec_replace function from cargo-util.