Skip to content

Commit

Permalink
ux: add warning when using wrong script format
Browse files Browse the repository at this point in the history
  • Loading branch information
ruben-arts committed Dec 11, 2023
1 parent 7eb3744 commit 0ef5c31
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/cli/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,19 @@ pub async fn run_activation_async(
project: &Project,
prefix: Prefix,
) -> miette::Result<HashMap<String, String>> {
let additional_activation_scripts = project.activation_scripts(Platform::current())?;
let platform = Platform::current();
let additional_activation_scripts = project.activation_scripts(platform)?;

// Check if the platform and activation script extension match. For Platform::Windows the extension should be .bat and for All other platforms it should be .sh or .bash.
for script in additional_activation_scripts.iter() {
let extension = script.extension().unwrap_or_default();
if platform.is_windows() && extension != "bat" {
tracing::warn!("The activation script '{}' does not have the correct extension for the platform '{}'. The extension should be '.bat'.", script.display(), platform);
} else if !platform.is_windows() && extension != "sh" && extension != "bash" {
tracing::warn!("The activation script '{}' does not have the correct extension for the platform '{}'. The extension should be '.sh' or '.bash'.", script.display(), platform);
}
}

await_in_progress(
"activating environment",
run_activation(prefix, additional_activation_scripts.into_iter().collect()),
Expand Down

0 comments on commit 0ef5c31

Please sign in to comment.