Skip to content

Commit

Permalink
fix eof push error with 0 exitcode
Browse files Browse the repository at this point in the history
ctrlok committed Dec 7, 2015

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
1 parent eec16c9 commit 215aa3a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/rocker/build/client.go
Original file line number Diff line number Diff line change
@@ -98,7 +98,7 @@ func (c *DockerClient) PullImage(name string) error {
pipeReader, pipeWriter = io.Pipe()
fdOut, isTerminalOut = term.GetFdInfo(c.log.Out)
out = c.log.Out
errch = make(chan error)
errch = make(chan error, 1)
)

if !isTerminalOut {
@@ -417,6 +417,7 @@ func (c *DockerClient) PushImage(imageName string) (digest string, err error) {
OutputStream: outStream,
RawJSONStream: true,
}
errch = make(chan error, 1)
)

if !isTerminalOut {
@@ -429,16 +430,18 @@ func (c *DockerClient) PushImage(imageName string) (digest string, err error) {

// TODO: DisplayJSONMessagesStream may fail by client.PushImage run without errors
go func() {
if err := jsonmessage.DisplayJSONMessagesStream(pipeReader, out, fdOut, isTerminalOut); err != nil {
c.log.Errorf("Failed to process json stream, error %s", err)
}
errch <- jsonmessage.DisplayJSONMessagesStream(pipeReader, out, fdOut, isTerminalOut)
}()

if err := c.client.PushImage(opts, c.auth); err != nil {
return "", err
}
pipeWriter.Close()

if err := <-errch; err != nil {
return "", fmt.Errorf("Failed to process json stream, error %s", err)
}

// It is the best way to have pushed image digest so far
matches := captureDigest.FindStringSubmatch(buf.String())
if len(matches) > 0 {

0 comments on commit 215aa3a

Please sign in to comment.