Commit c454413a authored by Matthew Sykes's avatar Matthew Sykes
Browse files

[FAB-11683] fix data race in GenerateDockerBuild



Logging introduced with FAB-11303 races with the asynchrounous stdout
stream processing.

Change-Id: Id231222dedf89aa098d1cfed7676c5cb268983f8
Signed-off-by: default avatarMatthew Sykes <sykesmat@us.ibm.com>
parent 5cc0dea7
......@@ -230,13 +230,14 @@ func DockerBuild(opts DockerBuildOptions) error {
cw.Close()
return fmt.Errorf("Error waiting for container to complete: %s", err)
}
// Wait for stream copying to complete before accessing stdout.
cw.Close()
if err := cw.Wait(); err != nil {
logger.Errorf("attach wait failed: %s", err)
}
if retval > 0 {
// Wait for stream copying to complete before getting output
if err := cw.Wait(); err != nil {
logger.Errorf("attach wait failed: %s", err)
}
return fmt.Errorf("Error returned from build: %d \"%s\"", retval, stdout.String())
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment