feat: add run cost when debug
This commit is contained in:
@@ -4,6 +4,7 @@ extern crate rust_util;
|
|||||||
use std::{env, fs, process};
|
use std::{env, fs, process};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
|
use std::time::SystemTime;
|
||||||
|
|
||||||
use rust_util::{util_cmd, util_msg};
|
use rust_util::{util_cmd, util_msg};
|
||||||
use rust_util::util_msg::MessageType;
|
use rust_util::util_msg::MessageType;
|
||||||
@@ -47,10 +48,14 @@ fn main() {
|
|||||||
run_script_cmd.arg(arg);
|
run_script_cmd.arg(arg);
|
||||||
}
|
}
|
||||||
debugging!("Run command: {:?}", run_script_cmd);
|
debugging!("Run command: {:?}", run_script_cmd);
|
||||||
|
let run_command_start = SystemTime::now();
|
||||||
match util_cmd::run_command_and_wait(&mut run_script_cmd) {
|
match util_cmd::run_command_and_wait(&mut run_script_cmd) {
|
||||||
Err(e) => failure_and_exit!("Run rust-script failed: {}", e),
|
Err(e) => failure_and_exit!("Run rust-script failed: {}", e),
|
||||||
Ok(exit_status) => {
|
Ok(exit_status) => {
|
||||||
write_script_file_to_src(script_file, cache_script_bin_name);
|
write_script_file_to_src(script_file, cache_script_bin_name);
|
||||||
|
if let Ok(run_command_cost) = SystemTime::now().duration_since(run_command_start) {
|
||||||
|
debugging!("Run command cost: {}ms", run_command_cost.as_millis());
|
||||||
|
}
|
||||||
process::exit(exit_status.code().unwrap_or_else(|| 0))
|
process::exit(exit_status.code().unwrap_or_else(|| 0))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user