Run 'cargo run' only once

This commit is contained in:
sharkdp
2018-11-02 18:33:06 +01:00
committed by David Peter
parent 278d841408
commit c6a526f99c
3 changed files with 15 additions and 1 deletions

View File

@ -1,10 +1,22 @@
extern crate assert_cmd;
extern crate escargot;
#[macro_use]
extern crate lazy_static;
use assert_cmd::prelude::*;
use escargot::CargoRun;
use std::process::Command;
lazy_static! {
static ref CARGO_RUN: CargoRun = escargot::CargoBuild::new()
.bin("bat")
.current_release()
.run()
.unwrap();
}
fn bat_with_config() -> Command {
let mut cmd = Command::main_binary().unwrap();
let mut cmd = CARGO_RUN.command();
cmd.current_dir("tests/examples");
cmd.env_remove("PAGER");
cmd.env_remove("BAT_PAGER");