Ensure script function is asynchronous

This commit is contained in:
Tobie Morgan Hitchcock 2022-07-04 00:57:42 +01:00
parent 039d2fbd54
commit 527361efd4
2 changed files with 7 additions and 2 deletions

View file

@ -105,7 +105,12 @@ impl Class for JsRecord {
}
}
pub fn run(ctx: &Context, src: &str, arg: Vec<Value>, doc: Option<&Value>) -> Result<Value, Error> {
pub async fn run(
ctx: &Context<'_>,
src: &str,
arg: Vec<Value>,
doc: Option<&Value>,
) -> Result<Value, Error> {
// Check the context
let _ = ctx.check()?;
// Create an execution context

View file

@ -136,7 +136,7 @@ impl Function {
for v in x {
a.push(v.compute(ctx, opt, txn, doc).await?);
}
fnc::script::run(ctx, s, a, doc)
fnc::script::run(ctx, s, a, doc).await
}
#[cfg(not(feature = "scripting"))]
{