aboutsummaryrefslogtreecommitdiff
path: root/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/shell/Shell.groovy
diff options
context:
space:
mode:
Diffstat (limited to 'bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/shell/Shell.groovy')
-rw-r--r--bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/shell/Shell.groovy9
1 files changed, 5 insertions, 4 deletions
diff --git a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/shell/Shell.groovy b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/shell/Shell.groovy
index 4df36422..fbd85e3b 100644
--- a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/shell/Shell.groovy
+++ b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/shell/Shell.groovy
@@ -83,13 +83,14 @@ class Shell {
}
ByteArrayOutputStream outStream = new ByteArrayOutputStream(4096)
ByteArrayOutputStream errStream = new ByteArrayOutputStream(4096)
- Thread.start {
- proc.consumeProcessOutput(outStream, errStream)
- }
if (timeout >= 0) {
+ // WARNING: there's a potential race condition bellow
+ // essentially what we really need here is
+ // proc.waitForOrKillProcessOutput(outStream, errStream)
+ proc.consumeProcessOutput(outStream, errStream)
proc.waitForOrKill(timeout)
} else {
- proc.waitFor()
+ proc.waitForProcessOutput(outStream, errStream)
}
// Possibly a bug in String.split as it generates a 1-element array on an