aboutsummaryrefslogtreecommitdiff
path: root/bigtop-test-framework
diff options
context:
space:
mode:
authorRoman Shaposhnik <rvs@cloudera.com>2013-04-30 17:08:26 -0700
committerRoman Shaposhnik <rvs@cloudera.com>2013-04-30 17:16:44 -0700
commitbc49df0bf3ed71dbe7a8ded7857b6087d4df8fd0 (patch)
tree918325fc1cfc0853ac9b150c52466cf028b477fc /bigtop-test-framework
parentbb2b739c4c4dc1137b8e54e6e174fb8b125b7101 (diff)
BIGTOP-950. race condition for output consumption in Shell code
Diffstat (limited to 'bigtop-test-framework')
-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