Skip to content
This repository has been archived by the owner on Jan 26, 2022. It is now read-only.

Commit

Permalink
Don't stop EM too early
Browse files Browse the repository at this point in the history
Otherwise we leave some callbacks behind.
  • Loading branch information
Jesse Zhang and Pieter Noordhuis committed Feb 20, 2013
1 parent bf0d393 commit 9041f1c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions em-posix-spawn/test/test_child.rb
Expand Up @@ -358,9 +358,10 @@ def test_listener_large_stdout
# attached to the same process.
def test_listener_nonempty_streams_active_process
em do
command = "printf A; sleep 0.01"
command << "; printf B; sleep 0.01"
command << "; printf C; sleep 0.01"
command = ['A', 'B', 'C'].map do |e|
'printf %s; sleep 0.01' % e
end.join(';')

p = Child.new(command)

data = ['', '']
Expand All @@ -370,15 +371,13 @@ def test_listener_nonempty_streams_active_process
data[0] << data_outer
if listener_outer.closed?
closed[0] = true
done if closed[1]
end
unless called
EM.next_tick do
p.add_streams_listener do |listener_inner, data_inner|
data[1] << data_inner
if listener_inner.closed?
closed[1] = true
done if closed[0]
end
end
end
Expand All @@ -391,6 +390,7 @@ def test_listener_nonempty_streams_active_process
assert p.success?
assert_equal "ABC", data[0]
assert_equal "ABC", data[1]
done
end
end
end
Expand Down

0 comments on commit 9041f1c

Please sign in to comment.