deivid-rodriguez / byebug

Debugging in Ruby 2
BSD 2-Clause "Simplified" License
3.34k stars 328 forks source link

Byebug does not work when called in a background process group #830

Open Mangara opened 2 years ago

Mangara commented 2 years ago

Problem description

When running the following program:

require "byebug"

pid = fork do
  Process.setpgrp
  byebug
end
Process.waitpid(pid)

Byebug stops the execution of the forked process and presents the source code, but it doesn't present a prompt, and while I can type anything, byebug doesn't react.

If I remove the Process.setpgrp line, everything works as expected. Similarly, if I switch the foreground process group with a C binding to tcsetpgrp, everything works as expected.

Expected behavior

I expected the (byebug) prompt to appear and to respond to input.

Actual behavior

The (byebug) prompt does not appear and byebug does not respond to input. (It hangs on readline.)

Steps to reproduce the problem

Run the program above.