mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[ruby/reline] Rescue ArgumentError from Signal.trap(:TSTP) on Windows
https://github.com/ruby/reline/commit/8da8182d1c
This commit is contained in:
parent
e8ad881336
commit
4885a61b12
1 changed files with 11 additions and 5 deletions
|
@ -170,10 +170,13 @@ class Reline::LineEditor
|
|||
@old_trap.call
|
||||
end
|
||||
}
|
||||
@old_tstp_trap = Signal.trap(:TSTP) {
|
||||
Reline::IOGate.ungetc("\C-z".ord)
|
||||
@old_tstp_trap.call if @old_tstp_trap.respond_to?(:call)
|
||||
}
|
||||
begin
|
||||
@old_tstp_trap = Signal.trap(:TSTP) {
|
||||
Reline::IOGate.ungetc("\C-z".ord)
|
||||
@old_tstp_trap.call if @old_tstp_trap.respond_to?(:call)
|
||||
}
|
||||
rescue ArgumentError
|
||||
end
|
||||
Reline::IOGate.set_winch_handler do
|
||||
@rest_height = (Reline::IOGate.get_screen_size.first - 1) - Reline::IOGate.cursor_pos.y
|
||||
old_screen_size = @screen_size
|
||||
|
@ -215,7 +218,10 @@ class Reline::LineEditor
|
|||
|
||||
def finalize
|
||||
Signal.trap('SIGINT', @old_trap)
|
||||
Signal.trap('SIGTSTP', @old_tstp_trap)
|
||||
begin
|
||||
Signal.trap('SIGTSTP', @old_tstp_trap)
|
||||
rescue ArgumentError
|
||||
end
|
||||
end
|
||||
|
||||
def eof?
|
||||
|
|
Loading…
Add table
Reference in a new issue