-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
We could add support of BSD by invoking uname -s and uname -a. Now, I am so new to Rust I can barely spell it. I am not even sure how I can add this to os_type to test it out. Any hand holding would be accepted. Here is what I have. It works for NetBSD, OpenBSD, FreeBSD, well any BSD derivative.
fn get_os_bsd() {
let nb_output = Command::new("uname").arg("-s").output()
.expect("failed to execute uname") ;
println!("OS stdout: {}", String::from_utf8_lossy(&nb_output.stdout)) ;
}
fn get_bsd_version() {
let nb_output = Command::new("uname").arg("-r").output()
.expect("failed to execute uname") ;
println!("Version stdout: {}", String::from_utf8_lossy(&nb_output.stdout)) ;
}
OUTPUT:
Mac (our solution much better)
OS stdout: Darwin
Version stdout: 18.2.0
NetBSD:
OS stdout: NetBSD
Version stdout: 8.99.35
FreeBSD:
OS stdout: FreeBSD
Version stdout: 12.0-RELEASE
OpenBSD:
OS stdout: OpenBSD
Version stdout: 6.4
Metadata
Metadata
Assignees
Labels
No labels