[ruby/irb] Fix kill pager pid throwing Errno::ESRCH when pager
process already terminated (https://github.com/ruby/irb/pull/989) https://github.com/ruby/irb/commit/949f032e9b
This commit is contained in:
parent
0610f1b083
commit
002e785e77
@ -33,7 +33,11 @@ module IRB
|
|||||||
# the `IRB::Abort` exception only interrupts IRB's execution but doesn't affect the pager
|
# the `IRB::Abort` exception only interrupts IRB's execution but doesn't affect the pager
|
||||||
# So to properly terminate the pager with Ctrl-C, we need to catch `IRB::Abort` and kill the pager process
|
# So to properly terminate the pager with Ctrl-C, we need to catch `IRB::Abort` and kill the pager process
|
||||||
rescue IRB::Abort
|
rescue IRB::Abort
|
||||||
Process.kill("TERM", pid) if pid
|
begin
|
||||||
|
Process.kill("TERM", pid) if pid
|
||||||
|
rescue Errno::ESRCH
|
||||||
|
# Pager process already terminated
|
||||||
|
end
|
||||||
nil
|
nil
|
||||||
rescue Errno::EPIPE
|
rescue Errno::EPIPE
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user