Skip to content

Instantly share code, notes, and snippets.

@piotrrojek
Created August 10, 2017 12:25
Show Gist options
  • Save piotrrojek/2fb0206569e2b5d957a9d8caa91cf9ae to your computer and use it in GitHub Desktop.
Save piotrrojek/2fb0206569e2b5d957a9d8caa91cf9ae to your computer and use it in GitHub Desktop.
use std::process::Command;
const VERSION: Option<&'static str> = option_env!("CARGO_PKG_VERSION");
fn main() {
println!("Hello, world!");
println!("version: {}", VERSION.unwrap_or("dev"));
let output = Command::new("git")
.args(&["rev-parse", "HEAD"])
.output().unwrap();
let git_hash = String::from_utf8(output.stdout).unwrap();
println!("Git hash: {}", git_hash)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment