Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use cmd.String() when logging binary_io command #978

Merged
merged 1 commit into from
Mar 24, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions internal/cmd/io_binary.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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")

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down