summaryrefslogtreecommitdiff
path: root/src/bin/pre-commit.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/pre-commit.rs')
-rw-r--r--src/bin/pre-commit.rs24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/bin/pre-commit.rs b/src/bin/pre-commit.rs
index 7b52443..361dd9c 100644
--- a/src/bin/pre-commit.rs
+++ b/src/bin/pre-commit.rs
@@ -1,14 +1,20 @@
+extern crate rust_git_hooks;
+use rust_git_hooks::*;
+
use std::env;
use std::io::{stdin, BufRead};
+use std::process;
+use std::process::{Command, Stdio};
fn main() {
- let args: Vec<_> = env::args().skip(1).collect();
- println!("pre-commit called with {:?}", args);
-
- println!("BEGIN STDIN for pre-commit");
- let stdin = stdin();
- for line in stdin.lock().lines() {
- println!("{:?}", line);
- }
- println!("END STDIN");
+ log();
+
+ let command = Command::new("cargo")
+ .arg("test")
+ .stdout(Stdio::inherit())
+ .stderr(Stdio::inherit())
+ .output()
+ .expect("failed to execute process");
+
+ process::exit(command.status.code().unwrap_or(0));
}