From 3f58f1f67b205fdf25fc26d4b273d14daa47f3fe Mon Sep 17 00:00:00 2001 From: iseki Date: Mon, 20 Jan 2025 11:55:36 +0800 Subject: [PATCH] fix(envscan): flush buffer after print --- cmd/murphy/internal/scan/cmd.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/murphy/internal/scan/cmd.go b/cmd/murphy/internal/scan/cmd.go index 84883d8..3c0762f 100644 --- a/cmd/murphy/internal/scan/cmd.go +++ b/cmd/murphy/internal/scan/cmd.go @@ -410,10 +410,10 @@ func doSBOMOnlyPrint(ctx context.Context, task *model.ScanTask) { } var bufioWriter = bufio.NewWriter(writer) var enc = json.NewEncoder(bufioWriter) - must.M(bufioWriter.Flush()) enc.SetIndent("", " ") if task.Modules == nil { task.Modules = make([]model.Module, 0) } must.M(enc.Encode(map[string]any{"modules": task.Modules})) + must.M(bufioWriter.Flush()) }