Puma causes Ruby 3 Debug to show ANSI escape sequences when pressing arrow keys (Mac ZSH)

113 views Asked by At

I'm on Mac OS 12.3.1 using Z shell.

When using the Ruby Debug gem (1.5) in Puma 5.6.4 with Ruby 3.0.0 the arrow keys do not work and instead print out the ANSI escape sequences (e.g. ^[[A for up). If I understand correctly, Puma is running on /bin/sh, which doesn't support the arrow keys.

Certainly I'm not the only one trying to debug a Rails 7 app on a Mac. Anyone else run into this and have a workaround?

1

There are 1 answers

0
Fred On

I have same problem with debug gem. I found it is caused by databasecleaner.

My workaround is

RSpec.configure do |config|
  config.before(:suite) do
    #DatabaseCleaner[:mongoid].clean_with(:deletion)
  end
  config.before(:each) do
    # DatabaseCleaner[:mongoid].strategy = :deletion
  end
  config.before(:each, :js => true) do
    #DatabaseCleaner[:mongoid].strategy = :deletion
  end
  config.before(:each) do
    DatabaseCleaner.start
  end
  config.after(:each) do
    # DatabaseCleaner.clean
  end
  config.before(:all) do
    # DatabaseCleaner.start
  end
  config.after(:all) do
    # DatabaseCleaner.clean
  end
end