1
0
mirror of https://github.com/rust-lang/rustlings.git synced 2025-06-29 00:41:42 +02:00
This commit is contained in:
liv
2019-01-09 20:33:58 +01:00
parent a388bb3798
commit e03a98cbf6
3 changed files with 25 additions and 28 deletions

View File

@ -1,7 +1,7 @@
use crate::util::clean;
use console::{style, Emoji};
use indicatif::ProgressBar;
use std::process::Command;
use crate::util::clean;
pub fn run(matches: clap::ArgMatches) {
if let Some(filename) = matches.value_of("file") {
@ -16,19 +16,17 @@ pub fn run(matches: clap::ArgMatches) {
if compilecmd.status.success() {
let runcmd = Command::new("./temp").output().expect("fail");
bar.finish_and_clear();
if runcmd.status.success() {
println!("{}", String::from_utf8_lossy(&runcmd.stdout));
let formatstr =
format!("{} Successfully ran {}", Emoji("", ""), filename);
let formatstr = format!("{} Successfully ran {}", Emoji("", ""), filename);
println!("{}", style(formatstr).green());
clean();
} else {
println!("{}", String::from_utf8_lossy(&runcmd.stdout));
println!("{}", String::from_utf8_lossy(&runcmd.stderr));
let formatstr =
format!("{} Ran {} with errors", Emoji("⚠️ ", "!"), filename);
let formatstr = format!("{} Ran {} with errors", Emoji("⚠️ ", "!"), filename);
println!("{}", style(formatstr).red());
clean();
}