Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Popen.communicate() instead of Popen.wait() #1689

Merged
merged 1 commit into from
Jan 5, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions test/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,12 @@ def _create_zk_chroot(self):
env = self.kafka_run_class_env()
proc = subprocess.Popen(args, env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE)

if proc.wait() != 0 or proc.returncode != 0:
stdout, stderr = proc.communicate()

if proc.returncode != 0:
self.out("Failed to create Zookeeper chroot node")
self.out(proc.stdout.read())
self.out(proc.stderr.read())
self.out(stdout)
self.out(stderr)
raise RuntimeError("Failed to create Zookeeper chroot node")
self.out("Kafka chroot created in Zookeeper!")

Expand Down Expand Up @@ -458,13 +460,12 @@ def _create_topic(self, topic_name, num_partitions, replication_factor, timeout_
args.append('--if-not-exists')
env = self.kafka_run_class_env()
proc = subprocess.Popen(args, env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
ret = proc.wait()
if ret != 0 or proc.returncode != 0:
output = proc.stdout.read()
if not 'kafka.common.TopicExistsException' in output:
stdout, stderr = proc.communicate()
if proc.returncode != 0:
if not 'kafka.common.TopicExistsException' in stdout:
self.out("Failed to create topic %s" % (topic_name,))
self.out(output)
self.out(proc.stderr.read())
self.out(stdout)
self.out(stderr)
raise RuntimeError("Failed to create topic %s" % (topic_name,))

def create_topics(self, topic_names, num_partitions=None, replication_factor=None):
Expand Down