mirror of
https://github.com/edera-dev/sprout.git
synced 2025-12-19 17:50:17 +00:00
fix(context): add context finalization iteration limit
This prevents any possibility of an infinite loop during finalization.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
use crate::context::SproutContext;
|
||||
use anyhow::{Result, bail};
|
||||
use anyhow::{Context, Result, bail};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::rc::Rc;
|
||||
|
||||
@@ -50,7 +50,10 @@ pub fn execute(context: Rc<SproutContext>, name: impl AsRef<str>) -> Result<()>
|
||||
bail!("unknown action '{}'", name.as_ref());
|
||||
};
|
||||
// Finalize the context and freeze it.
|
||||
let context = context.finalize().freeze();
|
||||
let context = context
|
||||
.finalize()
|
||||
.context("unable to finalize context")?
|
||||
.freeze();
|
||||
|
||||
// Execute the action.
|
||||
if let Some(chainload) = &action.chainload {
|
||||
|
||||
Reference in New Issue
Block a user