in integration/geb-gradle/src/main/groovy/geb/gradle/cloud/ExternalTunnel.groovy [74:108]
void startTunnel(boolean background) {
def command = assembleCommandLine()*.toString()
log.debug("Executing command: {}", command)
if (background) {
tunnelProcess = new ProcessBuilder(command).
redirectErrorStream(true).
directory(projectLayout.buildDirectory.asFile.get()).
start()
def latch = new CountDownLatch(1)
Thread.start {
try {
tunnelProcess.inputStream.eachLine { String line ->
if (latch.count) {
log.info "$outputPrefix: $line"
if (line.contains(tunnelReadyMessage.get())) {
latch.countDown()
}
} else {
log.debug "$outputPrefix: $line"
}
}
} catch (IOException ignore) {
}
}
if (!latch.await(timeout.get(), timeoutUnit.get())) {
throw new RuntimeException("Timeout waiting for tunnel to open")
}
} else {
execOperations.exec {
commandLine command
}
}
}