| 1 |
use std::process::Command; |
| 2 |
|
| 3 |
fn main() { |
| 4 |
// Print the rustc version. |
| 5 |
Command::new(env!("CARGO")) |
| 6 |
.args(&["rustc", "--quiet", "--", "--version"]) |
| 7 |
.status() |
| 8 |
.unwrap(); |
| 9 |
println!(); |
| 10 |
|
| 11 |
// Print the Cargo version. |
| 12 |
Command::new(env!("CARGO")) |
| 13 |
.args(&["--version"]) |
| 14 |
.status() |
| 15 |
.unwrap(); |
| 16 |
println!(); |
| 17 |
|
| 18 |
// Print the C compiler version. This relies on C compiler detection done |
| 19 |
// in build.rs, which sets the COMPILER_PATH variable. |
| 20 |
let compiler_path = env!("COMPILER_PATH"); |
| 21 |
let mut compiler_command = Command::new(compiler_path); |
| 22 |
// Use the --version flag on everything other than MSVC. |
| 23 |
if !cfg!(target_env = "msvc") { |
| 24 |
compiler_command.arg("--version"); |
| 25 |
} |
| 26 |
let _ = compiler_command.status().unwrap(); |
| 27 |
} |