From 67d2aa3be935708d4c58f21488515925c700a82b Mon Sep 17 00:00:00 2001 From: "mise[bot]" <123107610+mise-en-dev@users.noreply.github.com> Date: Sun, 13 Oct 2024 20:03:18 +0000 Subject: [PATCH] Commit from GitHub Actions (test) --- src/backend/asdf.rs | 3 +-- src/backend/cargo.rs | 3 +-- src/backend/go.rs | 3 +-- src/backend/mod.rs | 33 +++++++++++--------------------- src/backend/npm.rs | 3 +-- src/backend/pipx.rs | 3 +-- src/backend/spm.rs | 3 +-- src/backend/ubi.rs | 3 +-- src/backend/vfox.rs | 3 +-- src/cli/generate/task_docs.rs | 3 +-- src/cli/run.rs | 2 ++ src/cli/tasks/deps.rs | 3 +-- src/cli/tasks/info.rs | 3 +-- src/cli/use.rs | 3 +-- src/config/env_directive.rs | 3 +-- src/exit.rs | 3 +++ src/plugins/asdf_plugin.rs | 6 ++---- src/plugins/core/java.rs | 3 +-- src/plugins/core/mod.rs | 3 +-- src/plugins/core/python.rs | 3 +-- src/plugins/core/ruby_windows.rs | 1 + src/shims.rs | 3 +-- src/ui/ctrlc_stub.rs | 6 +----- 23 files changed, 37 insertions(+), 65 deletions(-) diff --git a/src/backend/asdf.rs b/src/backend/asdf.rs index 40b9ae4f2e..3684db0db7 100644 --- a/src/backend/asdf.rs +++ b/src/backend/asdf.rs @@ -15,8 +15,7 @@ use crate::backend::external_plugin_cache::ExternalPluginCache; use crate::backend::{ABackend, Backend, BackendList}; use crate::cache::{CacheManager, CacheManagerBuilder}; use crate::cli::args::BackendArg; -use crate::config::SETTINGS; -use crate::config::{Config, Settings}; +use crate::config::{Config, Settings, SETTINGS}; use crate::default_shorthands::DEFAULT_SHORTHANDS; use crate::env_diff::{EnvDiff, EnvDiffOperation}; use crate::git::Git; diff --git a/src/backend/cargo.rs b/src/backend/cargo.rs index a68ebe0d1c..d94d79d81b 100644 --- a/src/backend/cargo.rs +++ b/src/backend/cargo.rs @@ -9,8 +9,7 @@ use crate::backend::{Backend, BackendType}; use crate::cache::{CacheManager, CacheManagerBuilder}; use crate::cli::args::BackendArg; use crate::cmd::CmdLineRunner; -use crate::config::SETTINGS; -use crate::config::{Config, Settings}; +use crate::config::{Config, Settings, SETTINGS}; use crate::env::GITHUB_TOKEN; use crate::file; use crate::http::HTTP_FETCH; diff --git a/src/backend/go.rs b/src/backend/go.rs index ad82830c38..51a752a394 100644 --- a/src/backend/go.rs +++ b/src/backend/go.rs @@ -4,8 +4,7 @@ use crate::backend::{Backend, BackendType}; use crate::cache::{CacheManager, CacheManagerBuilder}; use crate::cli::args::BackendArg; use crate::cmd::CmdLineRunner; -use crate::config::Settings; -use crate::config::SETTINGS; +use crate::config::{Settings, SETTINGS}; use crate::install_context::InstallContext; use crate::toolset::ToolRequest; diff --git a/src/backend/mod.rs b/src/backend/mod.rs index cf7a72ccc6..69d6fda026 100644 --- a/src/backend/mod.rs +++ b/src/backend/mod.rs @@ -17,8 +17,7 @@ use versions::Versioning; use self::backend_meta::BackendMeta; use crate::cli::args::{BackendArg, ToolVersionType}; use crate::cmd::CmdLineRunner; -use crate::config::SETTINGS; -use crate::config::{Config, CONFIG}; +use crate::config::{Config, CONFIG, SETTINGS}; use crate::file::{display_path, remove_all, remove_all_with_warning}; use crate::install_context::InstallContext; use crate::plugins::core::{CorePlugin, CORE_PLUGINS}; @@ -86,26 +85,25 @@ fn load_tools() -> BackendMap { .iter() .map(|(_, p)| p.clone()) .collect::>(); - let (tx, rx) = crossbeam_channel::unbounded(); + let mut asdf_tools = Ok(vec![]); + let mut vfox_tools = Ok(vec![]); + let mut backend_tools = Ok(vec![]); rayon::scope(|s| { if !cfg!(windows) || SETTINGS.asdf { - let tx = tx.clone(); - s.spawn(move |_| tx.send(asdf::AsdfBackend::list()).unwrap()); + s.spawn(|_| asdf_tools = asdf::AsdfBackend::list()); } if cfg!(windows) || SETTINGS.vfox { - let tx = tx.clone(); - s.spawn(move |_| tx.send(vfox::VfoxBackend::list()).unwrap()); + s.spawn(|_| vfox_tools = vfox::VfoxBackend::list()); } - s.spawn(move |_| tx.send(list_installed_backends()).unwrap()); + backend_tools = list_installed_backends(); }); - for backend in rx { - tools.extend(backend.expect("Error loading backends")); - } - + tools.extend(asdf_tools.expect("asdf tools failed to load")); + tools.extend(vfox_tools.expect("vfox tools failed to load")); + tools.extend(backend_tools.expect("backend tools failed to load")); tools.retain(|backend| !SETTINGS.disable_tools.contains(backend.id())); + let tools: BackendMap = tools .into_iter() - .sorted_by_cached_key(rank_backend) .map(|plugin| (plugin.id().to_string(), plugin)) .collect(); *TOOLS.lock().unwrap() = Some(tools.clone()); @@ -113,15 +111,6 @@ fn load_tools() -> BackendMap { tools } -fn rank_backend(backend: &ABackend) -> (usize, String) { - let rank = match backend.get_plugin_type() { - PluginType::Core => 0, - PluginType::Vfox => 1, - PluginType::Asdf => 2, - }; - (rank, backend.id().to_string()) -} - fn list_installed_backends() -> eyre::Result { Ok(file::dir_subdirs(&dirs::INSTALLS)? .into_par_iter() diff --git a/src/backend/npm.rs b/src/backend/npm.rs index 6f1b166316..a81791bd16 100644 --- a/src/backend/npm.rs +++ b/src/backend/npm.rs @@ -5,8 +5,7 @@ use crate::backend::{Backend, BackendType}; use crate::cache::{CacheManager, CacheManagerBuilder}; use crate::cli::args::BackendArg; use crate::cmd::CmdLineRunner; -use crate::config::Config; -use crate::config::SETTINGS; +use crate::config::{Config, SETTINGS}; use crate::install_context::InstallContext; use crate::toolset::ToolRequest; diff --git a/src/backend/pipx.rs b/src/backend/pipx.rs index f71ec0be74..7fe0537f02 100644 --- a/src/backend/pipx.rs +++ b/src/backend/pipx.rs @@ -2,8 +2,7 @@ use crate::backend::{Backend, BackendType}; use crate::cache::{CacheManager, CacheManagerBuilder}; use crate::cli::args::BackendArg; use crate::cmd::CmdLineRunner; -use crate::config::SETTINGS; -use crate::config::{Config, Settings}; +use crate::config::{Config, Settings, SETTINGS}; use crate::github; use crate::http::HTTP_FETCH; use crate::install_context::InstallContext; diff --git a/src/backend/spm.rs b/src/backend/spm.rs index 90901b3d34..6a1a29156f 100644 --- a/src/backend/spm.rs +++ b/src/backend/spm.rs @@ -2,8 +2,7 @@ use crate::backend::{Backend, BackendType}; use crate::cache::{CacheManager, CacheManagerBuilder}; use crate::cli::args::BackendArg; use crate::cmd::CmdLineRunner; -use crate::config::Settings; -use crate::config::SETTINGS; +use crate::config::{Settings, SETTINGS}; use crate::install_context::InstallContext; use crate::{file, github}; use eyre::WrapErr; diff --git a/src/backend/ubi.rs b/src/backend/ubi.rs index b57d5a8086..499cacd196 100644 --- a/src/backend/ubi.rs +++ b/src/backend/ubi.rs @@ -4,8 +4,7 @@ use crate::backend::{Backend, BackendType}; use crate::cache::{CacheManager, CacheManagerBuilder}; use crate::cli::args::BackendArg; use crate::cmd::CmdLineRunner; -use crate::config::SETTINGS; -use crate::config::{Config, Settings}; +use crate::config::{Config, Settings, SETTINGS}; use crate::env::GITHUB_TOKEN; use crate::github; use crate::install_context::InstallContext; diff --git a/src/backend/vfox.rs b/src/backend/vfox.rs index b3f8acafc5..acf4f67e7a 100644 --- a/src/backend/vfox.rs +++ b/src/backend/vfox.rs @@ -12,8 +12,7 @@ use url::Url; use crate::backend::{ABackend, Backend, BackendList, BackendType}; use crate::cache::{CacheManager, CacheManagerBuilder}; use crate::cli::args::BackendArg; -use crate::config::SETTINGS; -use crate::config::{Config, Settings}; +use crate::config::{Config, Settings, SETTINGS}; use crate::git::Git; use crate::install_context::InstallContext; use crate::plugins::PluginType; diff --git a/src/cli/generate/task_docs.rs b/src/cli/generate/task_docs.rs index 84624f006a..8f7effcd8f 100644 --- a/src/cli/generate/task_docs.rs +++ b/src/cli/generate/task_docs.rs @@ -1,5 +1,4 @@ -use crate::config::CONFIG; -use crate::config::SETTINGS; +use crate::config::{CONFIG, SETTINGS}; use crate::{dirs, file}; use std::path::PathBuf; diff --git a/src/cli/run.rs b/src/cli/run.rs index dac0196882..7ac59278ed 100644 --- a/src/cli/run.rs +++ b/src/cli/run.rs @@ -23,6 +23,7 @@ use either::Either; use eyre::{bail, ensure, eyre, Result}; use glob::glob; use itertools::Itertools; +#[cfg(unix)] use nix::sys::signal::SIGTERM; /// [experimental] Run task(s) @@ -222,6 +223,7 @@ impl Run { recv(rx_err) -> task => { // a task errored let (task, status) = task.unwrap(); self.add_failed_task(task, status); + #[cfg(unix)] CmdLineRunner::kill_all(SIGTERM); // start killing other running tasks } } diff --git a/src/cli/tasks/deps.rs b/src/cli/tasks/deps.rs index 28b1dac80f..50ef84bf69 100644 --- a/src/cli/tasks/deps.rs +++ b/src/cli/tasks/deps.rs @@ -4,8 +4,7 @@ use itertools::Itertools; use petgraph::dot::Dot; use crate::config::{CONFIG, SETTINGS}; -use crate::task::Deps; -use crate::task::Task; +use crate::task::{Deps, Task}; use crate::ui::style::{self}; use crate::ui::tree::print_tree; diff --git a/src/cli/tasks/info.rs b/src/cli/tasks/info.rs index 648de42f06..bbd5161e17 100644 --- a/src/cli/tasks/info.rs +++ b/src/cli/tasks/info.rs @@ -1,8 +1,7 @@ use eyre::{bail, Result}; use serde_json::json; -use crate::config::CONFIG; -use crate::config::SETTINGS; +use crate::config::{CONFIG, SETTINGS}; use crate::file::display_path; use crate::task::Task; use crate::ui::info; diff --git a/src/cli/use.rs b/src/cli/use.rs index de9d3cca22..bfdc4f7840 100644 --- a/src/cli/use.rs +++ b/src/cli/use.rs @@ -6,8 +6,7 @@ use itertools::Itertools; use crate::cli::args::{BackendArg, ToolArg}; use crate::config::config_file::ConfigFile; -use crate::config::SETTINGS; -use crate::config::{config_file, is_global_config, Config, LOCAL_CONFIG_FILENAMES}; +use crate::config::{config_file, is_global_config, Config, LOCAL_CONFIG_FILENAMES, SETTINGS}; use crate::env::{ MISE_DEFAULT_CONFIG_FILENAME, MISE_DEFAULT_TOOL_VERSIONS_FILENAME, MISE_GLOBAL_CONFIG_FILE, }; diff --git a/src/config/env_directive.rs b/src/config/env_directive.rs index 5008246a2c..dc995816cb 100644 --- a/src/config/env_directive.rs +++ b/src/config/env_directive.rs @@ -9,8 +9,7 @@ use serde::{Deserialize, Deserializer}; use crate::cmd::CmdLineRunner; use crate::config::config_file::trust_check; -use crate::config::Config; -use crate::config::SETTINGS; +use crate::config::{Config, SETTINGS}; use crate::env::PATH_KEY; use crate::env_diff::{EnvDiff, EnvDiffOperation}; use crate::file::{display_path, which_non_pristine}; diff --git a/src/exit.rs b/src/exit.rs index 8dfe2ca196..edff4cad59 100644 --- a/src/exit.rs +++ b/src/exit.rs @@ -1,8 +1,11 @@ use crate::cmd::CmdLineRunner; +#[cfg(unix)] use nix::sys::signal::SIGTERM; pub fn exit(code: i32) -> ! { + #[cfg(unix)] CmdLineRunner::kill_all(SIGTERM); + debug!("exiting with code: {code}"); std::process::exit(code) } diff --git a/src/plugins/asdf_plugin.rs b/src/plugins/asdf_plugin.rs index 76361eda33..2cebd12ae2 100644 --- a/src/plugins/asdf_plugin.rs +++ b/src/plugins/asdf_plugin.rs @@ -1,8 +1,6 @@ -use crate::config::SETTINGS; -use crate::config::{Config, Settings}; +use crate::config::{Config, Settings, SETTINGS}; use crate::default_shorthands::{DEFAULT_SHORTHANDS, TRUSTED_SHORTHANDS}; use crate::errors::Error::PluginNotInstalled; -use crate::exit; use crate::file::{display_path, remove_all}; use crate::git::Git; use crate::plugins::{Plugin, PluginList, PluginType, Script, ScriptManager}; @@ -11,7 +9,7 @@ use crate::timeout::run_with_timeout; use crate::ui::multi_progress_report::MultiProgressReport; use crate::ui::progress_report::SingleReport; use crate::ui::prompt; -use crate::{dirs, lock_file}; +use crate::{dirs, exit, lock_file}; use clap::Command; use console::style; use contracts::requires; diff --git a/src/plugins/core/java.rs b/src/plugins/core/java.rs index 77f1fc7e13..5677133875 100644 --- a/src/plugins/core/java.rs +++ b/src/plugins/core/java.rs @@ -8,8 +8,7 @@ use crate::cache::{CacheManager, CacheManagerBuilder}; use crate::cli::args::BackendArg; use crate::cli::version::{ARCH, OS}; use crate::cmd::CmdLineRunner; -use crate::config::Config; -use crate::config::SETTINGS; +use crate::config::{Config, SETTINGS}; use crate::http::{HTTP, HTTP_FETCH}; use crate::install_context::InstallContext; use crate::plugins::core::CorePlugin; diff --git a/src/plugins/core/mod.rs b/src/plugins/core/mod.rs index f2701d59e2..77c8866f01 100644 --- a/src/plugins/core/mod.rs +++ b/src/plugins/core/mod.rs @@ -9,8 +9,7 @@ pub use python::PythonPlugin; use crate::backend::{Backend, BackendMap}; use crate::cache::{CacheManager, CacheManagerBuilder}; use crate::cli::args::BackendArg; -use crate::config::Settings; -use crate::config::SETTINGS; +use crate::config::{Settings, SETTINGS}; use crate::env; use crate::env::PATH_KEY; use crate::http::HTTP_FETCH; diff --git a/src/plugins/core/python.rs b/src/plugins/core/python.rs index 3b125f49c7..fbb04174f8 100644 --- a/src/plugins/core/python.rs +++ b/src/plugins/core/python.rs @@ -3,8 +3,7 @@ use crate::build_time::built_info; use crate::cache::{CacheManager, CacheManagerBuilder}; use crate::cli::args::BackendArg; use crate::cmd::CmdLineRunner; -use crate::config::Config; -use crate::config::SETTINGS; +use crate::config::{Config, SETTINGS}; use crate::file::display_path; use crate::git::Git; use crate::http::{HTTP, HTTP_FETCH}; diff --git a/src/plugins/core/ruby_windows.rs b/src/plugins/core/ruby_windows.rs index e858127a50..fc47656cbb 100644 --- a/src/plugins/core/ruby_windows.rs +++ b/src/plugins/core/ruby_windows.rs @@ -17,6 +17,7 @@ use contracts::requires; use eyre::Result; use itertools::Itertools; use versions::Versioning; +use xx::regex; #[derive(Debug)] pub struct RubyPlugin { diff --git a/src/shims.rs b/src/shims.rs index d37c3ffd6f..360cb3c79f 100644 --- a/src/shims.rs +++ b/src/shims.rs @@ -7,8 +7,7 @@ use std::sync::Arc; use crate::backend::Backend; use crate::cli::exec::Exec; -use crate::config::CONFIG; -use crate::config::SETTINGS; +use crate::config::{CONFIG, SETTINGS}; use crate::file::display_path; use crate::lock_file::LockFile; use crate::toolset::{ToolVersion, Toolset, ToolsetBuilder}; diff --git a/src/ui/ctrlc_stub.rs b/src/ui/ctrlc_stub.rs index d8b7ade80e..f61cec153d 100644 --- a/src/ui/ctrlc_stub.rs +++ b/src/ui/ctrlc_stub.rs @@ -1,12 +1,8 @@ -#[must_use] -#[derive(Debug)] -pub struct HandleGuard(); - pub fn init() -> eyre::Result<()> { Ok(()) } -pub fn add_handler(_func: impl Fn() + Send + Sync + 'static) {} +// pub fn add_handler(_func: impl Fn() + Send + Sync + 'static) {} pub fn exit_on_ctrl_c(_do_exit: bool) {}