| Crates.io | popen_rs |
| lib.rs | popen_rs |
| version | 0.1.0 |
| created_at | 2025-07-24 09:50:17.713134+00 |
| updated_at | 2025-07-24 09:50:17.713134+00 |
| description | Simple Process Spawning Library |
| homepage | |
| repository | https://github.com/f42h/popen_rs |
| max_upload_size | |
| id | 1765863 |
| size | 7,859 |
This small Rust library simplifies the process of running system commands by
spawning a new child process and reading the content of either the stdout
or stderr stream handle.
use popen_rs::Popen;
spawnpub fn spawn(&mut self) -> io::Result<String>
pidpub fn pid(&mut self) -> Option<u32>
use popen_rs::Popen;
fn main() {
let command = "ls -l";
let mut process = Popen::new(command);
match process.spawn() {
Ok(output) => {
let pid = process.pid().unwrap();
println!("Output of `{}` [PID:{}]:", command, pid);
println!("\n{}", output);
},
Err(err) => eprintln!("Error: {}", err),
}
}
This project is published under the MIT License.