Skip to content

Commit

Permalink
properly flush batch
Browse files Browse the repository at this point in the history
Signed-off-by: Jess Frazelle <[email protected]>
  • Loading branch information
jessfraz committed Feb 28, 2025
1 parent a0924bc commit a1f148a
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/wasm-lib/kcl/src/execution/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,29 @@ impl ExecutorContext {
)
})?;

// Flush the batch with all the end commands.
// If we don't do this then some programs might not fully finish executing.
self.engine
.flush_batch(true, SourceRange::default())
.await
.map_err(|e| {
let module_id_to_module_path: IndexMap<ModuleId, ModulePath> = exec_state
.global
.path_to_source_id
.iter()
.map(|(k, v)| ((*v), k.clone()))
.collect();

KclErrorWithOutputs::new(
e,
exec_state.global.operations.clone(),
exec_state.global.artifact_commands.clone(),
exec_state.global.artifact_graph.clone(),
module_id_to_module_path,
exec_state.global.id_to_source.clone(),
)

Check warning on line 763 in src/wasm-lib/kcl/src/execution/mod.rs

View check run for this annotation

Codecov / codecov/patch

src/wasm-lib/kcl/src/execution/mod.rs#L749-L763

Added lines #L749 - L763 were not covered by tests
})?;

if !self.is_mock() {
let mut mem = exec_state.memory().clone();
mem.restore_env(env_ref);
Expand Down

0 comments on commit a1f148a

Please sign in to comment.