From 42da4b3f2379bbb1d55f7bd8481de93253cb2062 Mon Sep 17 00:00:00 2001 From: Roland Schaer Date: Mon, 10 Jun 2024 17:16:06 +0200 Subject: [PATCH] fix: mise plugins ls returns error immediately after install (#2271) --- src/plugins/asdf_plugin.rs | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/plugins/asdf_plugin.rs b/src/plugins/asdf_plugin.rs index 231c7acb47..65d7656e5e 100644 --- a/src/plugins/asdf_plugin.rs +++ b/src/plugins/asdf_plugin.rs @@ -24,14 +24,20 @@ impl AsdfPlugin { pub fn list() -> eyre::Result { let settings = Settings::get(); - Ok(file::ls(*dirs::PLUGINS)? - .into_par_iter() - .map(|dir| { - let name = dir.file_name().unwrap().to_string_lossy().to_string(); - Box::new(AsdfPlugin::new(name)) as Box - }) - .filter(|p| !settings.disable_tools.contains(p.name())) - .collect()) + match file::ls(*dirs::PLUGINS) { + Ok(dirs) => { + let plugins = dirs + .into_par_iter() + .map(|dir| { + let name = dir.file_name().unwrap().to_string_lossy().to_string(); + Box::new(AsdfPlugin::new(name)) as Box + }) + .filter(|p| !settings.disable_tools.contains(p.name())) + .collect(); + Ok(plugins) + } + Err(_) => Ok(PluginList::new()), + } } }