From e746a523e8b9ba7843a75e7ff7e96c954badb8b5 Mon Sep 17 00:00:00 2001 From: Maksim An Date: Fri, 19 Mar 2021 13:22:56 -0700 Subject: [PATCH] use cmd.String() when logging binary_io command additionally clean up potential linter errors Signed-off-by: Maksim An --- internal/cmd/io_binary.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/internal/cmd/io_binary.go b/internal/cmd/io_binary.go index 1fde77e482..59a0da9f7a 100644 --- a/internal/cmd/io_binary.go +++ b/internal/cmd/io_binary.go @@ -61,7 +61,11 @@ func NewBinaryIO(ctx context.Context, id string, uri *url.URL) (_ UpstreamIO, er if err != nil { return nil, err } - defer waitPipe.Close() + defer func() { + if err := waitPipe.Close(); err != nil { + log.G(ctx).WithError(err).Errorf("error closing wait pipe: %s", waitPipePath) + } + }() envs := []string{ "CONTAINER_ID=" + id, @@ -102,7 +106,7 @@ func NewBinaryIO(ctx context.Context, id string, uri *url.URL) (_ UpstreamIO, er log.G(ctx).WithFields(logrus.Fields{ "containerID": id, "containerNamespace": ns, - "binaryCmd": cmd, + "binaryCmd": cmd.String(), "binaryProcessID": cmd.Process.Pid, }).Debug("binary io process started") @@ -198,7 +202,7 @@ func (b *binaryIO) Close(ctx context.Context) { }) } -func (b *binaryIO) CloseStdin(ctx context.Context) {} +func (b *binaryIO) CloseStdin(_ context.Context) {} func (b *binaryIO) Stdin() io.Reader { return nil @@ -273,7 +277,9 @@ func (p *pipe) Read(b []byte) (int, error) { } func (p *pipe) Close() error { - p.l.Close() + if err := p.l.Close(); err != nil { + log.G(context.TODO()).WithError(err).Debug("error closing pipe listener") + } p.conWg.Wait() if p.con != nil { return p.con.Close()