Skip to content

Commit

Permalink
Merge pull request #2189 from rajatjindal/error-if-plugin-binary-missing
Browse files Browse the repository at this point in the history
print error msg when plugin binary is missing
  • Loading branch information
rajatjindal authored Dec 20, 2023
2 parents 49ba8fe + d8b5d04 commit 5639597
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/commands/external.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::build_info::*;
use crate::commands::plugins::{update, Install};
use crate::opts::PLUGIN_OVERRIDE_COMPATIBILITY_CHECK_FLAG;
use anyhow::{anyhow, Result};
use spin_common::ui::quoted_path;
use spin_plugins::{
badger::BadgerChecker, error::Error as PluginError, manifest::warn_unsupported_version,
PluginStore,
Expand Down Expand Up @@ -66,7 +67,16 @@ pub async fn execute_external_subcommand(
)
.await?;

let mut command = Command::new(plugin_store.installed_binary_path(&plugin_name));
let binary = plugin_store.installed_binary_path(&plugin_name);
if !binary.exists() {
return Err(anyhow!(
"plugin executable {} is missing. Try uninstalling and installing the plugin '{}' again.",
quoted_path(&binary),
plugin_name
));
}

let mut command = Command::new(binary);
command.args(args);
command.envs(get_env_vars_map()?);

Expand Down

0 comments on commit 5639597

Please sign in to comment.