diff options
Diffstat (limited to 'test/ruby/test_beginendblock.rb')
-rw-r--r-- | test/ruby/test_beginendblock.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/test/ruby/test_beginendblock.rb b/test/ruby/test_beginendblock.rb index caed180613..2ddcddd43b 100644 --- a/test/ruby/test_beginendblock.rb +++ b/test/ruby/test_beginendblock.rb @@ -1,5 +1,6 @@ require 'test/unit' require 'tempfile' +require 'timeout' require_relative 'envutil' class TestBeginEndBlock < Test::Unit::TestCase @@ -96,8 +97,10 @@ EOW out = IO.popen( [ruby, '-e', 'STDERR.reopen(STDOUT)', - '-e', 'at_exit{Process.kill(:INT, $$); loop{}}']) {|f| - f.read + '-e', 'at_exit{Process.kill(:INT, $$); sleep 5 }']) {|f| + timeout(10) { + f.read + } } assert_match(/Interrupt$/, out) Process.kill(0, 0) rescue return # check if signal works |