Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/irb/pager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ def page(retain_content: false)
# SIGTERM not supported (windows)
Process.kill("KILL", pid)
end

begin
# Wait for the pager process to terminate.
# Reading next input from Reline before the pager process is fully terminated
# may cause issues like raw/cooked mode not being controlled properly.
Process.waitpid(pid) if pid
rescue Errno::ECHILD, Errno::ESRCH
end
rescue Errno::ESRCH
# Pager process already terminated
end
Expand Down