Skip to content

Commit b841168

Browse files
committed
Timeout in the child process
1 parent 9e3ec5b commit b841168

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

test/io/console/test_io_console.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,15 +315,16 @@ def assert_ctrl(expect, cc, r, w)
315315
def test_intr
316316
run_pty("#{<<~"begin;"}\n#{<<~'end;'}") do |r, w, _|
317317
begin;
318+
require 'timeout'
318319
STDOUT.puts `stty -a`.scan(/\b\w+ *= *\^.;/), ""
319320
STDOUT.flush
320321
con = IO.console
321322
while c = con.getch
322323
p c.ord
323324
p con.getch(intr: false).ord
324325
begin
325-
p con.getch(intr: true).ord
326-
rescue Interrupt => e
326+
p Timeout.timeout(1) {con.getch(intr: true)}.ord
327+
rescue Timeout::Error, Interrupt => e
327328
p e
328329
end
329330
end

0 commit comments

Comments
 (0)