From 6e57cb466f2ccd7b0eb4de216f45d3eddfcb3665 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Mon, 25 May 2020 19:28:42 -0400 Subject: also suppress error if the socket file doesn't exist --- src/bin/rbw/actions.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/bin/rbw/actions.rs b/src/bin/rbw/actions.rs index caeb636..035ebe6 100644 --- a/src/bin/rbw/actions.rs +++ b/src/bin/rbw/actions.rs @@ -31,13 +31,13 @@ pub fn quit() -> anyhow::Result<()> { wait_for_exit(pid)?; Ok(()) } - Err(e) => { - if e.kind() == std::io::ErrorKind::ConnectionRefused { - Ok(()) - } else { - Err(e.into()) - } - } + Err(e) => match e.kind() { + // if the socket doesn't exist, or the socket exists but nothing + // is listening on it, the agent must already be not running + std::io::ErrorKind::ConnectionRefused + | std::io::ErrorKind::NotFound => Ok(()), + _ => Err(e.into()), + }, } } -- cgit v1.2.3-54-g00ecf