Pry with spork does not block

I’m trying to use Pry with spork and it doesn’t work for me. The issue
seems that reading from stdin does not block, so Pry does not block. Any
read from STDIN returns right away.

rspec -X console.rb

File follows:

require ‘spec_helper’

describe ‘console’ do
it ‘opens!’ do
Pry.config.input = STDIN
Pry.config.output = STDOUT
puts STDIN.closed? # returns false
binding.pry # returns right away, does not block
gets # returns right way, does not block

Do you guys have any idea on how I can go about debugging this? I want
to inspect what kind of file descriptor is STDIN, and it might be a
pipe, but I didn’t get much further than that.

Constantin, did you ever find a solution to this issue? I’m experiencing
the same thing.

Yes I was able to make some progress, but I not fully resolved the

This works on linux:

tty = tty.chomp, “w+”)

Pry.config.input = tty
Pry.config.output = tty

Now pry will block, but there are still some issues:

  1. the prompt will appear after I press enter. This is probably a
    buffering issue.
  2. Readline and history keys don’t work.

Maybe you can get to the bottom of this and find some workarounds.