From 3c5287a1b4ce39d901b15fb5e4aa2fa00c88a3c9 Mon Sep 17 00:00:00 2001 From: mitchell Date: Tue, 9 Jul 2024 16:11:37 -0400 Subject: [PATCH] Fixed nil pointer error with `state exec` and async runtimes. --- internal/runners/exec/exec.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/internal/runners/exec/exec.go b/internal/runners/exec/exec.go index a5460204c0..d97e452005 100644 --- a/internal/runners/exec/exec.go +++ b/internal/runners/exec/exec.go @@ -119,9 +119,16 @@ func (s *Exec) Run(params *Params, args ...string) (rerr error) { s.out.Notice(locale.Tr("operating_message", projectNamespace, projectDir)) - rt, err := rtrunbit.SolveAndUpdate(s.auth, s.out, s.analytics, proj, nil, trigger, s.svcModel, s.cfg, rtrunbit.OptMinimalUI) + rt, commit, err := rtrunbit.Solve(s.auth, s.out, s.analytics, proj, nil, trigger, s.svcModel, s.cfg, rtrunbit.OptMinimalUI) if err != nil { - return locale.WrapError(err, "err_activate_runtime", "Could not initialize a runtime for this project.") + return errs.Wrap(err, "Could not initialize runtime") + } + + if !s.cfg.GetBool(constants.AsyncRuntimeConfig) { + err = rtrunbit.UpdateByReference(rt, commit, s.auth, proj, s.out, s.cfg, rtrunbit.OptMinimalUI) + if err != nil { + return errs.Wrap(err, "Could not setup runtime") + } } venv := virtualenvironment.New(rt)