ldd: always copy stderr
Dropping the buffer on success is unhelpful and could hide some useful information. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
parent
bf07b7cd9e
commit
bc54db54d2
@ -3,6 +3,7 @@ package ldd
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"time"
|
"time"
|
||||||
@ -35,7 +36,9 @@ func ExecFilter(ctx context.Context,
|
|||||||
|
|
||||||
if err := container.Start(); err != nil {
|
if err := container.Start(); err != nil {
|
||||||
return nil, err
|
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
|
return nil, err
|
||||||
}
|
}
|
||||||
if err := container.Wait(); err != nil {
|
if err := container.Wait(); err != nil {
|
||||||
@ -44,8 +47,6 @@ func ExecFilter(ctx context.Context,
|
|||||||
bytes.Contains(m, msgStaticGlibc) {
|
bytes.Contains(m, msgStaticGlibc) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
_, _ = os.Stderr.Write(m)
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user