go-vise

Constrained Size Output Virtual Machine
Info | Log | Files | Refs | README | LICENSE

commit 1f2af8672dc7c39995915056faa0f9e9b588fdde
parent ce50317bc4d660e2327a3b6ae9447cfed595d688
Author: lash <dev@holbrook.no>
Date:   Wed, 11 Sep 2024 17:21:38 +0100

Enable engine exit output after state restart

Diffstat:
MMakefile | 3+--
Mengine/db.go | 15+++++++++------
2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile @@ -31,6 +31,5 @@ doc: make -C doc cov: - #go test -cover ./... -coverprofile=cover.out - go test -cover ./engine/... -coverprofile=cover.out + go test -cover ./... -coverprofile=cover.out go tool cover -html=cover.out diff --git a/engine/db.go b/engine/db.go @@ -493,12 +493,15 @@ func(en *DefaultEngine) WriteResult(ctx context.Context, w io.Writer) (int, erro logg.TraceCtxf(ctx, "render with state", "state", en.st) r, err := en.vm.Render(ctx) if err != nil { - return 0, err - } - if len(r) > 0 { - l, err = io.WriteString(w, r) - if err != nil { - return l, err + if len(en.exit) == 0 { + return 0, err + } + } else { + if len(r) > 0 { + l, err = io.WriteString(w, r) + if err != nil { + return l, err + } } } if len(en.exit) > 0 {