Skip to content

Commit

Permalink
use cmd.String() when logging binary_io command
Browse files Browse the repository at this point in the history
additionally clean up potential linter errors

Signed-off-by: Maksim An <[email protected]>
  • Loading branch information
anmaxvl committed Mar 19, 2021
1 parent 885f896 commit e869ce2
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions internal/cmd/io_binary.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,12 @@ func NewBinaryIO(ctx context.Context, id string, uri *url.URL) (_ UpstreamIO, er
if err != nil {
return nil, err
}
defer waitPipe.Close()
defer func() {
err := waitPipe.Close()
if err != nil {
log.G(ctx).Errorf("error closing wait pipe: %s", waitPipePath)
}
}()

envs := []string{
"CONTAINER_ID=" + id,
Expand Down Expand Up @@ -102,7 +107,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")

Expand Down Expand Up @@ -198,7 +203,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
Expand Down Expand Up @@ -273,7 +278,7 @@ func (p *pipe) Read(b []byte) (int, error) {
}

func (p *pipe) Close() error {
p.l.Close()
_ = p.l.Close()
p.conWg.Wait()
if p.con != nil {
return p.con.Close()
Expand Down

0 comments on commit e869ce2

Please sign in to comment.