diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-03-17 00:08:00 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-03-17 00:08:00 +0900 |
| commit | bc54db54d2b33e5ed29667be69d0c07eed9bb007 (patch) | |
| tree | d149ffaac3c263617fb72cbb961ad49346e9a3a6 /ldd/exec.go | |
| parent | bf07b7cd9e8e305c619a45c8171dada4286c3fbf (diff) | |
ldd: always copy stderr
Dropping the buffer on success is unhelpful and could hide some useful information.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'ldd/exec.go')
| -rw-r--r-- | ldd/exec.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/ldd/exec.go b/ldd/exec.go index 4854c85e..55d16cf7 100644 --- a/ldd/exec.go +++ b/ldd/exec.go @@ -3,6 +3,7 @@ package ldd import ( "bytes" "context" + "io" "os" "os/exec" "time" @@ -35,7 +36,9 @@ func ExecFilter(ctx context.Context, if err := container.Start(); err != nil { return nil, err - } else if err = container.Serve(); err != nil { + } + defer func() { _, _ = io.Copy(os.Stderr, stderr) }() + if err := container.Serve(); err != nil { return nil, err } if err := container.Wait(); err != nil { @@ -44,8 +47,6 @@ func ExecFilter(ctx context.Context, bytes.Contains(m, msgStaticGlibc) { return nil, nil } - - _, _ = os.Stderr.Write(m) return nil, err } |
