summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYO4 <[email protected]>2024-11-05 22:53:36 +0900
committergit <[email protected]>2024-11-05 13:53:41 +0000
commited06f018bdffe9bb7f8bdbf15fa5a727e402bfe9 (patch)
tree05d8e65591eb87decf37c96064573fd62e35e223
parente440268d51fe02b303e3817a7a733a0dac1c5091 (diff)
[ruby/irb] windows does not support Process.kill("TERM", pid)
(https://github.com/ruby/irb/pull/1026) https://github.com/ruby/irb/commit/7bbb885163
-rw-r--r--lib/irb/pager.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/irb/pager.rb b/lib/irb/pager.rb
index 558318cdb8..7c1249dd5c 100644
--- a/lib/irb/pager.rb
+++ b/lib/irb/pager.rb
@@ -34,7 +34,12 @@ module IRB
# So to properly terminate the pager with Ctrl-C, we need to catch `IRB::Abort` and kill the pager process
rescue IRB::Abort
begin
- Process.kill("TERM", pid) if pid
+ begin
+ Process.kill("TERM", pid) if pid
+ rescue Errno::EINVAL
+ # SIGTERM not supported (windows)
+ Process.kill("KILL", pid)
+ end
rescue Errno::ESRCH
# Pager process already terminated
end