cross-exec

Crates.iocross-exec
lib.rscross-exec
version0.1.1
created_at2026-01-21 18:19:34.627453+00
updated_at2026-01-21 18:23:38.342094+00
description⚡️ Unix CommandExt::exec but isomorphic
homepagehttps://docs.rs/cross-exec
repositoryhttps://github.com/jcbhmr/cross-exec-rs
max_upload_size
id2059823
size13,128
Jacob Hummer (jcbhmr)

documentation

README

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.

Commit count: 14

cargo fmt