Comments (5)
HI @bitaxis, thanks for the feedback! I got that same issue when I first started developing and using byebug, but didn't investigate further. I am pretty sure what I did was just starting the server in normal mode (without the -u
flag) and it worked just right without having to install debugger.
Could you try that and let me know whether it works for you?
from byebug.
@deivid-rodriguez Yes. If I leave out the -u
flag, then the error goes away, and I can still break into my code using byebug
. I also verified that I can break into my code using the debugger gem also. Which begs the question, what is the -u
flag for exactly?
Anyhow, I will close this ticket now. Thanks!
from byebug.
That's a good question. If I find out I will let you know! :)
from byebug.
Hi again @bitaxis! I investigated this today. Some answers:
what's the
-u
flag for exactly?
Starting the server in debugging mode allows you to have full stack information in your rails application. That means that the debugger is started when the server is started. If you don't use the debugging flag, the debugger will be started when the byebug
or debugger
call is issued inside your application, so you will only have debug information from that point on.
That's the reason why the first time you break into your code, if you issue the command where
, the backtrace will only contain one entry, because byebug
was just started. On the other hand, if you use the -u
flag you will get full stack information from the beggining.
does the
-u
flag work with byebug?
No, it doesn't. Rails specifically requires and starts debugger
(see here). To workaround this, you can monkeypatch rails by adding a file config/initializers/rack_byebug.rb (for example) to your app with the following contents:
module Rails
module Rack
class Debugger
def initialize(app)
@app = app
# clear ARGV so that rails server options aren't passed to IRB
ARGV.clear
require 'byebug'
::Byebug.start
puts "=> Byebug enabled"
rescue LoadError
puts "You're missing the 'byebug' gem. Add it to your Gemfile, bundle " \
"it and try again."
exit(1)
end
def call(env)
@app.call(env)
end
end
end
end
I will probably include a similar monkeypatch inside byebug but in the meantime this should work.
from byebug.
Since byebug 1.5.0 rails debugging flag is no longer necessary. Don't use it.
from byebug.
Related Issues (20)
- Cannot step into require method in Ruby 3.0.0
- byebug tends to get "stuck" in the debugger in Windows Terminal with tabs HOT 2
- Provide a way to exit the program without exiting the Rails Console
- Segmentation Fault in Ruby 3.0 Rspec HOT 5
- Only show program files in backtrace (excluding gems)
- [macOS][11.4] ERROR: Error installing byebug 11.1.3 HOT 3
- [macOS][12.0] ERROR: Error installing byebug 11.1.3 HOT 3
- Default port in byebug CLI
- Test failure with ruby 3.0.2 HOT 1
- Is it possible to make post_mortem the default behaviour?
- Byebug does not work when called in a background process group
- byebug-6 compile issue
- Exceptions when running `frame` or `backtrace` on a Sinatra application
- Arguments for `where`
- BuildError: ERROR: Failed to build gem native extension byebug 8.2.1 HOT 5
- cannot load such file -- irb (LoadError)
- Homebrew Formula error: No available formula with the name "formula". Did you mean foreman? Error: Broken pipe
- Build dependency on chandler, which is archived/unmaintained HOT 1
- Byebug error parses a comma in a string as an endinger for a line of code HOT 1
- Commands with no description HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from byebug.