From 8e3d959500a2eb9873fdcf38b4393f255f8e405d Mon Sep 17 00:00:00 2001 From: James Shubin Date: Tue, 29 Oct 2024 16:37:55 -0400 Subject: [PATCH] util: We prefer to append rather than truncate This makes this utility function more useful. --- util/exec.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/util/exec.go b/util/exec.go index d6ab5a0f..5b850899 100644 --- a/util/exec.go +++ b/util/exec.go @@ -32,7 +32,6 @@ package util import ( "bytes" "context" - "os" "os/exec" "strings" "syscall" @@ -83,7 +82,7 @@ func SimpleCmd(ctx context.Context, name string, args []string, opts *SimpleCmdO out := b.String() if opts != nil && opts.LogOutput != "" { - if err := os.WriteFile(opts.LogOutput, b.Bytes(), 0600); err != nil { + if err := AppendFile(opts.LogOutput, b.Bytes(), 0600); err != nil { logf("unable to store log: %v", err) } else { logf("wrote log to: %s", opts.LogOutput)