From 905a926ea84e199478e32e6da5cd0e8d756132f1 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Tue, 17 Dec 2019 18:20:37 +0900 Subject: [ruby/io-console] Timeout in the child process https://github.com/ruby/io-console/commit/b8411689a5 --- test/io/console/test_io_console.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/io/console/test_io_console.rb b/test/io/console/test_io_console.rb index 083b4a7fb9..219b84615e 100644 --- a/test/io/console/test_io_console.rb +++ b/test/io/console/test_io_console.rb @@ -330,6 +330,7 @@ defined?(PTY) and defined?(IO.console) and TestIO_Console.class_eval do def test_intr run_pty("#{<<~"begin;"}\n#{<<~'end;'}") do |r, w, _| begin; + require 'timeout' STDOUT.puts `stty -a`.scan(/\b\w+ *= *\^.;/), "" STDOUT.flush con = IO.console @@ -337,8 +338,8 @@ defined?(PTY) and defined?(IO.console) and TestIO_Console.class_eval do p c.ord p con.getch(intr: false).ord begin - p con.getch(intr: true).ord - rescue Interrupt => e + p Timeout.timeout(1) {con.getch(intr: true)}.ord + rescue Timeout::Error, Interrupt => e p e end end -- cgit v1.2.3