util: We prefer to append rather than truncate
This makes this utility function more useful.
This commit is contained in:
@@ -32,7 +32,6 @@ package util
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"os"
|
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
@@ -83,7 +82,7 @@ func SimpleCmd(ctx context.Context, name string, args []string, opts *SimpleCmdO
|
|||||||
out := b.String()
|
out := b.String()
|
||||||
|
|
||||||
if opts != nil && opts.LogOutput != "" {
|
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)
|
logf("unable to store log: %v", err)
|
||||||
} else {
|
} else {
|
||||||
logf("wrote log to: %s", opts.LogOutput)
|
logf("wrote log to: %s", opts.LogOutput)
|
||||||
|
|||||||
Reference in New Issue
Block a user