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
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
|
@old_trap.call
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
@old_tstp_trap = Signal.trap(:TSTP) {
|
begin
|
||||||
Reline::IOGate.ungetc("\C-z".ord)
|
@old_tstp_trap = Signal.trap(:TSTP) {
|
||||||
@old_tstp_trap.call if @old_tstp_trap.respond_to?(:call)
|
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
|
Reline::IOGate.set_winch_handler do
|
||||||
@rest_height = (Reline::IOGate.get_screen_size.first - 1) - Reline::IOGate.cursor_pos.y
|
@rest_height = (Reline::IOGate.get_screen_size.first - 1) - Reline::IOGate.cursor_pos.y
|
||||||
old_screen_size = @screen_size
|
old_screen_size = @screen_size
|
||||||
|
@ -215,7 +218,10 @@ class Reline::LineEditor
|
||||||
|
|
||||||
def finalize
|
def finalize
|
||||||
Signal.trap('SIGINT', @old_trap)
|
Signal.trap('SIGINT', @old_trap)
|
||||||
Signal.trap('SIGTSTP', @old_tstp_trap)
|
begin
|
||||||
|
Signal.trap('SIGTSTP', @old_tstp_trap)
|
||||||
|
rescue ArgumentError
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def eof?
|
def eof?
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue