diff options
author | Matthew Draper <matthew@trebex.net> | 2017-04-05 06:25:25 +0930 |
---|---|---|
committer | Matthew Draper <matthew@trebex.net> | 2017-04-05 06:27:52 +0930 |
commit | c866cf9df8b7d767f8be8272b120b44f453212cb (patch) | |
tree | 9f5f7eda7317601a4c2f1a7c4fec5e0fb769e847 /actioncable/test/client_test.rb | |
parent | a1c36ba32b2d6ee8a23c03eaf7778bbe61f40263 (diff) | |
download | rails-c866cf9df8b7d767f8be8272b120b44f453212cb.tar.gz rails-c866cf9df8b7d767f8be8272b120b44f453212cb.tar.bz2 rails-c866cf9df8b7d767f8be8272b120b44f453212cb.zip |
Avoid "can't modify frozen IOError" failures
https://bugs.ruby-lang.org/issues/13239
Diffstat (limited to 'actioncable/test/client_test.rb')
-rw-r--r-- | actioncable/test/client_test.rb | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/actioncable/test/client_test.rb b/actioncable/test/client_test.rb index 98a114a5f4..4f7c585ba3 100644 --- a/actioncable/test/client_test.rb +++ b/actioncable/test/client_test.rb @@ -68,12 +68,23 @@ class ClientTest < ActionCable::TestCase server.min_threads = 1 server.max_threads = 4 - t = Thread.new { server.run.join } - yield port + thread = server.run - ensure - server.stop(true) if server - t.join if t + begin + yield port + + ensure + server.stop + + begin + thread.join + rescue RuntimeError => ex + raise unless ex.message =~ /can't modify frozen IOError/ + + # Work around https://bugs.ruby-lang.org/issues/13239 + server.binder.close + end + end end class SyncClient |