Skip to content

Commit 63d5a69

Browse files
committed
Change env var name
1 parent 02c92e1 commit 63d5a69

File tree

4 files changed

+13
-10
lines changed

4 files changed

+13
-10
lines changed

src/cargo/ops/cargo_run.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ pub fn run(ws: &Workspace,
6565
let mut process = compile.target_process(exe, &pkg)?;
6666
process.args(args).cwd(config.cwd());
6767

68-
if config.wrap_exe() {
68+
if config.print_run() {
6969
machine_message::emit(RunProfile::new(&process));
7070
Ok(None)
7171
} else {

src/cargo/ops/cargo_test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ fn run_unit_tests(options: &TestOptions,
9797
shell.status("Running", to_display.display().to_string())
9898
})?;
9999

100-
if config.wrap_exe() {
100+
if config.print_run() {
101101
machine_message::emit(RunProfile::new(&cmd));
102102
} else {
103103
config.shell().verbose(|shell| {
@@ -124,7 +124,7 @@ fn run_doc_tests(options: &TestOptions,
124124

125125
// We don't build/rust doctests if target != host or
126126
// if we are not supposed to run binaries.
127-
if config.rustc()?.host != compilation.target || config.wrap_exe() {
127+
if config.rustc()?.host != compilation.target || config.print_run() {
128128
return Ok((Test::Doc, errors));
129129
}
130130

src/cargo/util/config.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ pub struct Config {
3333
extra_verbose: Cell<bool>,
3434
frozen: Cell<bool>,
3535
locked: Cell<bool>,
36-
wrap_exe: Cell<bool>,
36+
/// When this is set, Cargo does not run binaries
37+
/// during `cargo run`/`cargo test`. Instead it
38+
/// prints what it should have run otherwise.
39+
print_run: Cell<bool>,
3740
}
3841

3942
impl Config {
@@ -51,7 +54,7 @@ impl Config {
5154
extra_verbose: Cell::new(false),
5255
frozen: Cell::new(false),
5356
locked: Cell::new(false),
54-
wrap_exe: Cell::new(false),
57+
print_run: Cell::new(false),
5558
}
5659
}
5760

@@ -363,7 +366,7 @@ impl Config {
363366
self.extra_verbose.set(extra_verbose);
364367
self.frozen.set(frozen);
365368
self.locked.set(locked);
366-
self.wrap_exe.set(env::var("CARGO_WRAP").is_ok());
369+
self.print_run.set(env::var("CARGO_PRINT_RUN").is_ok());
367370

368371
Ok(())
369372
}
@@ -380,8 +383,8 @@ impl Config {
380383
!self.frozen.get() && !self.locked.get()
381384
}
382385

383-
pub fn wrap_exe(&self) -> bool {
384-
self.wrap_exe.get()
386+
pub fn print_run(&self) -> bool {
387+
self.print_run.get()
385388
}
386389

387390
fn load_values(&self) -> CargoResult<HashMap<String, ConfigValue>> {

tests/intercept_exe.rs renamed to tests/print_run.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ fn single_bin() {
1818
fn main() { println!("hello"); }
1919
"#);
2020

21-
assert_that(p.cargo_process("run").env("CARGO_WRAP", "1"),
21+
assert_that(p.cargo_process("run").env("CARGO_PRINT_RUN", "1"),
2222
execs().with_status(0)
2323
.with_stderr(&"\
2424
[COMPILING] foo v0.0.1 ([..])
@@ -87,7 +87,7 @@ fn several_tests() {
8787
"CARGO_MANIFEST_DIR": "[..]",
8888
"CARGO": "[..]"
8989
}"#;
90-
assert_that(p.cargo_process("test").env("CARGO_WRAP", "1"),
90+
assert_that(p.cargo_process("test").env("CARGO_PRINT_RUN", "1"),
9191
execs().with_status(0)
9292
.with_json(&format!(r#"
9393
{{

0 commit comments

Comments
 (0)