aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2020-05-23 22:39:56 -0400
committerJesse Luehrs <doy@tozt.net>2020-05-23 23:10:58 -0400
commit871bd25407d83d610272c0b6403098c6cd38619a (patch)
treea41bc98e2b72c3d4c68d8240f7e68a9584f76488
parentf82345336c1edad86420b3b61ebb8578eb495a3e (diff)
downloadrbw-871bd25407d83d610272c0b6403098c6cd38619a.tar.gz
rbw-871bd25407d83d610272c0b6403098c6cd38619a.zip
fix error if `rbw config set base_url` is run before setting email
-rw-r--r--src/bin/rbw/commands.rs14
1 files changed, 10 insertions, 4 deletions
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(())
}