From 871bd25407d83d610272c0b6403098c6cd38619a Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sat, 23 May 2020 22:39:56 -0400 Subject: fix error if `rbw config set base_url` is run before setting email --- src/bin/rbw/commands.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/bin/rbw/commands.rs') diff --git a/src/bin/rbw/commands.rs b/src/bin/rbw/commands.rs index 99522d1..0213962 100644 --- a/src/bin/rbw/commands.rs +++ b/src/bin/rbw/commands.rs @@ -341,8 +341,11 @@ pub fn config_set(key: &str, value: &str) -> anyhow::Result<()> { config.save().context("failed to save config file")?; // drop in-memory keys, since they will be different if the email or url - // changed - lock()?; + // changed. not using lock() because we don't want to require the agent to + // be running (since this may be the user running `rbw config set + // base_url` as the first operation), and stop_agent() already handles the + // agent not running case gracefully. + stop_agent()?; Ok(()) } @@ -362,8 +365,11 @@ pub fn config_unset(key: &str) -> anyhow::Result<()> { config.save().context("failed to save config file")?; // drop in-memory keys, since they will be different if the email or url - // changed - lock()?; + // changed. not using lock() because we don't want to require the agent to + // be running (since this may be the user running `rbw config set + // base_url` as the first operation), and stop_agent() already handles the + // agent not running case gracefully. + stop_agent()?; Ok(()) } -- cgit v1.2.3-54-g00ecf