Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: should now use the activated environment when running a task #1461

Merged
Merged
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
19 changes: 7 additions & 12 deletions src/cli/run.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use std::collections::hash_map::Entry;
use std::collections::HashSet;
use std::convert::identity;
use std::str::FromStr;
use std::{collections::HashMap, path::PathBuf, string::String};

use crate::config::ConfigCli;
Expand All @@ -23,7 +22,6 @@ use crate::Project;
use crate::lock_file::LockFileDerivedData;
use crate::lock_file::UpdateLockFileOptions;
use crate::progress::await_in_progress;
use crate::project::manifest::EnvironmentName;
use crate::project::virtual_packages::verify_current_platform_has_required_virtual_packages;
use crate::project::Environment;
use thiserror::Error;
Expand Down Expand Up @@ -63,16 +61,13 @@ pub async fn execute(args: Args) -> miette::Result<()> {
verify_prefix_location_unchanged(project.default_environment().dir().as_path()).await?;

// Extract the passed in environment name.
let explicit_environment = args
.environment
.map(|n| EnvironmentName::from_str(n.as_str()))
.transpose()?
.map(|n| {
project
.environment(&n)
.ok_or_else(|| miette::miette!("unknown environment '{n}'"))
})
.transpose()?;
let environment = project.environment_from_name_or_env_var(args.environment.clone())?;
// Find the environment to run the task in, if any were specified.
let explicit_environment = if environment.is_default() {
None
} else {
Some(environment)
};

// Verify that the current platform has the required virtual packages for the environment.
if let Some(ref explicit_environment) = explicit_environment {
Expand Down
Loading