Transmode / gradle-docker

A Gradle plugin to build Docker images from the build script.
Apache License 2.0
647 stars 142 forks source link

There is a bug in NativeDockerClient.executeAndWait() #59

Closed jt214 closed 9 years ago

jt214 commented 9 years ago

The NativeDockerClient.executeAndWait() method is not handling the output buffer properly.

See: http://stackoverflow.com/questions/159148/groovy-executing-shell-commands

When the files including in the container are large (approx. 750mb), the executeAndWait method just hangs indefinitely.

The method should be written like:

private static String executeAndWait(String cmdLine) {
    print "\nexecuteAndWait(${cmdLine})\n\n"

    def process = cmdLine.execute()
    def inStream = new StringBuffer()
    def outStream = new StringBuffer()

    process.waitForProcessOutput(inStream, outStream)
    if (process.exitValue()) {
        throw new GradleException("Docker execution failed\nCommand line [${cmdLine}] returned:\n${outStream}")
    }
    return inStream
}
bjornmagnusson commented 9 years ago

This is fixed in dev branch already