diff options
Diffstat (limited to 'src/cli/plugin.rs')
| -rw-r--r-- | src/cli/plugin.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/cli/plugin.rs b/src/cli/plugin.rs index efdb9eca..a2c1e6c3 100644 --- a/src/cli/plugin.rs +++ b/src/cli/plugin.rs @@ -701,6 +701,15 @@ fn parse_split_direction(value: &str) -> Option<SplitDirection> { } fn normalize_plugin_path_arg(value: &str) -> std::io::Result<String> { + if super::target::is_remote() { + if super::target::remote_path_is_absolute(value) { + return Ok(value.to_owned()); + } + return Err(std::io::Error::new( + std::io::ErrorKind::InvalidInput, + "remote plugin paths must be absolute", + )); + } let path = crate::worktree::expand_tilde_path(value); let absolute = if path.is_absolute() { path @@ -1618,6 +1627,9 @@ fn current_unix_ms() -> u64 { } fn is_connection_error(err: &std::io::Error) -> bool { + if super::target::is_remote() { + return false; + } // A `server_not_running` marker is a connect failure for recovery purposes: // treating it as a connection error lets plugin commands fall back to the // offline registry. The marker carries (but does not print) a friendly @@ -1672,6 +1684,15 @@ fn print_plugin_pane_help() { mod tests { use super::*; + #[test] + fn machine_plugin_connection_errors_never_use_local_offline_state() { + crate::cli::target::with_test_client(crate::api::client::ApiClient::local(), || { + assert!(!is_connection_error(&std::io::Error::from( + std::io::ErrorKind::ConnectionRefused + ))); + }); + } + fn unique_plugin_id(label: &str) -> String { let nanos = SystemTime::now() .duration_since(UNIX_EPOCH) |
