Skip to content
Open
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
9 changes: 7 additions & 2 deletions test/command/test_fluentd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,15 @@ def assert_fluentd_fails_to_start(cmdline, *pattern_list, timeout: 20)
execute_command(cmdline) do |pid, stdout|
begin
waiting(timeout) do
while process_exist?(pid) && !running
# Read until EOF (the write-end of the pipe is closed when the
# process exits) so that we don't miss the final error message.
# Gating the loop on `process_exist?(pid)` is racy: the process can
# write its last line and exit right after `eager_read`, leaving
# that line unread in the pipe buffer.
until running
readables, _, _ = IO.select([stdout], nil, nil, 1)
next unless readables
next if readables.first.eof?
break if readables.first.eof?

stdio_buf << eager_read(readables.first)
lines = stdio_buf.split("\n")
Expand Down