From 41123157c6d356006af12425863f003a4dc87f3d Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Thu, 21 May 2020 23:18:57 -0400 Subject: don't pretend that the version is 0 if the version command fails this was intended to paper over agents that didn't recognize the version command, but they almost certainly don't exist at this point and it makes the error messages super confusing --- src/bin/rbw/commands.rs | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'src/bin/rbw/commands.rs') diff --git a/src/bin/rbw/commands.rs b/src/bin/rbw/commands.rs index b9be09b..2934de3 100644 --- a/src/bin/rbw/commands.rs +++ b/src/bin/rbw/commands.rs @@ -791,15 +791,11 @@ fn ensure_agent() -> anyhow::Result<()> { rbw::protocol::VERSION, version ); - if version != 0 { - crate::actions::quit()?; - } + crate::actions::quit()?; ensure_agent_once()?; let version = version_or_quit()?; if version != rbw::protocol::VERSION { - if version != 0 { - crate::actions::quit()?; - } + crate::actions::quit()?; return Err(anyhow::anyhow!( "incompatible protocol versions: client ({}), agent ({})", rbw::protocol::VERSION, @@ -834,13 +830,9 @@ fn ensure_agent_once() -> anyhow::Result<()> { } fn version_or_quit() -> anyhow::Result { - Ok(match crate::actions::version() { - Ok(version) => version, - Err(e) => { - log::warn!("{}", e); - crate::actions::quit()?; - 0 - } + crate::actions::version().or_else(|e| { + let _ = crate::actions::quit(); + Err(e) }) } -- cgit v1.2.3-54-g00ecf