Skip to content

Commit 21b46bf

Browse files
committed
Fix running --script commands from PATH
1 parent ede2262 commit 21b46bf

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Diff for: src/toolchains.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -238,11 +238,13 @@ impl Toolchain {
238238
.join(&format!("target-{}", self.rustup_name())),
239239
);
240240
}
241-
let script = cfg
242-
.args
243-
.script
244-
.as_ref()
245-
.map(|script| std::env::current_dir().unwrap().join(script));
241+
let script = cfg.args.script.as_ref().map(|script| {
242+
if script.exists() {
243+
std::env::current_dir().unwrap().join(script)
244+
} else {
245+
script.to_owned()
246+
}
247+
});
246248

247249
let mut cmd = match (script, cfg.args.timeout) {
248250
(Some(script), None) => {

0 commit comments

Comments
 (0)