Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,16 @@ impl InputAction {

let built_binary_path = platform::binary_cache_path()
.join(if release_mode { "release" } else { "debug" })
.join(&self.bin_name);
.join({
#[cfg(windows)]
{
format!("{}.exe", &self.bin_name)
}
#[cfg(not(windows))]
{
&self.bin_name
}
});

let manifest_path = self.manifest_path();

Expand Down
4 changes: 4 additions & 0 deletions tests/data/script-using-env.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
let msg = option_env!("_RUST_SCRIPT_TEST_MESSAGE").unwrap_or("undefined");

println!("--output--");
println!("msg = {}", msg);
28 changes: 28 additions & 0 deletions tests/tests/script.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,34 @@ fn test_whitespace_before_main() {
.unwrap()
}

#[test]
fn test_force_rebuild() {
for option in ["-f", "--force"] {
std::env::remove_var("_RUST_SCRIPT_TEST_MESSAGE");

let script_path = "tests/data/script-using-env.rs";
let out = rust_script!(option, script_path).unwrap();
scan!(out.stdout_output();
("msg = undefined") => ()
)
.unwrap();

std::env::set_var("_RUST_SCRIPT_TEST_MESSAGE", "hello");

let out = rust_script!(script_path).unwrap();
scan!(out.stdout_output();
("msg = undefined") => ()
)
.unwrap();

let out = rust_script!(option, script_path).unwrap();
scan!(out.stdout_output();
("msg = hello") => ()
)
.unwrap();
}
}

#[test]
#[ignore]
fn test_stable_toolchain() {
Expand Down