Skip to content

Commit f2dbabd

Browse files
authored
fix(cli): Ensure home directory exists when writing contexts (#3069)
1 parent b956a5d commit f2dbabd

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

  • core/cli/src/commands/binary_context

core/cli/src/commands/binary_context/common.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ impl ContextManager {
149149
let mut new_contexts = cs.contexts.clone();
150150
new_contexts.insert(name.to_string(), config);
151151

152-
self.context_rw.ensure_iggy_home_exists().await?;
153152
self.context_rw
154153
.write_contexts(new_contexts.clone())
155154
.await
@@ -289,6 +288,7 @@ impl ContextReaderWriter {
289288
contexts_path.display()
290289
))?;
291290

291+
self.ensure_iggy_home_exists().await?;
292292
tokio::fs::write(&contexts_path, contents).await?;
293293
Self::set_owner_only_permissions(&contexts_path).await?;
294294
}
@@ -320,6 +320,7 @@ impl ContextReaderWriter {
320320
}
321321

322322
pub async fn write_active_context(&self, context_name: &str) -> Result<()> {
323+
self.ensure_iggy_home_exists().await?;
323324
let maybe_active_context_path = self.active_context_path();
324325

325326
if let Some(active_context_path) = maybe_active_context_path {

0 commit comments

Comments
 (0)