From 39f4df76d38083776aa4a4316b9358f5d448ff84 Mon Sep 17 00:00:00 2001 From: David Schmitt Date: Wed, 28 Feb 2024 17:29:16 +0100 Subject: [PATCH] Shut down engines cleanly --- cmd/terraform_plan.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmd/terraform_plan.go b/cmd/terraform_plan.go index e396d976..d8e8f9df 100644 --- a/cmd/terraform_plan.go +++ b/cmd/terraform_plan.go @@ -200,6 +200,9 @@ func TerraformPlan(ctx context.Context, files []string, ready chan bool) int { log.WithError(err).Error("failed to start AWS source engine") return 1 } + defer func() { + _ = awsEngine.Stop() + }() stdlibEngine, err := stdlibsource.InitializeStdlibSourceEngine(natsOptions, 2_000, true) if err != nil { @@ -213,6 +216,9 @@ func TerraformPlan(ctx context.Context, files []string, ready chan bool) int { log.WithError(err).Error("failed to start stdlib source engine") return 1 } + defer func() { + _ = stdlibEngine.Stop() + }() prompt := `# Doing something