1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
//! A cross-platform Rust library for running programs with elevated privileges.
//!
//! This library provides functions to run programs with elevated privileges on both Windows and Unix-like systems.
//!
//! # Examples
//!
//! ## Windows
//!
//! ```
//! use elevator_lib::run_elevated;
//!
//! // Run a program with elevated privileges on Windows
//! if let Err(err) = run_elevated("C:\\Windows\\System32\\notepad.exe", &["C:\\example.txt"]) {
//! eprintln!("Error: {}", err);
//! }
//! ```
//!
//! ## Unix-like
//!
//! ```
//! use elevator_lib::run_elevated;
//!
//! // Run a program with elevated privileges on Unix-like systems
//! if let Err(err) = run_elevated("/usr/bin/some_program", &["arg1", "arg2"]) {
//! eprintln!("Error: {}", err);
//! }
//! ```
// windows:
#[cfg(windows)]
mod windows;
#[cfg(windows)]
pub use windows::*;
// unix:
#[cfg(unix)]
mod unix;
#[cfg(unix)]
pub use unix::*;