SitePoint Sponsor |
|
User Tag List
Results 1 to 6 of 6
Thread: irb wont return a value
-
Oct 5, 2009, 19:55 #1
- Join Date
- Oct 2009
- Posts
- 3
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
irb wont return a value
I have just started the book Simply Rails 2. When I tried the irb for the first time I entered irb> 1. Problem is I dont get a return value. Nothing happens, just a blank blinking cursor. Any ideas?
-
Oct 6, 2009, 00:00 #2
- Join Date
- Sep 2009
- Location
- Melbourne, Australia
- Posts
- 228
- Mentioned
- 1 Post(s)
- Tagged
- 0 Thread(s)
I think the bullet list just before that code listing might be what's confusing you here: "lines beginning with the Ruby shell prompt (irb>) are typed in by the user."
You don't actually type the "irb>", that's the ruby shell prompt (it might be different on your system, on my Mac right now it's ">>"). You type "irb" and hit enter at your system command prompt to start irb, then you just type "1" and hit return, the ruby interpreter will return 1 (no big surprise there!)
Let me know if any of that is unclear and I'll try to help.
Cheers,
-
Oct 6, 2009, 16:52 #3
- Join Date
- Oct 2009
- Posts
- 3
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Thank you for your help. I'm new to programming and literally do exactly what the book says. Your advice worked. I understand now. While I am at it, I do have one other question for you if you don't mind. When I start Mongrel, I enter ruby script/server. Do I just exit the window when done, or do I wait for some return value. Right now the ruby window just shows blank, no return value.
-
Oct 6, 2009, 16:57 #4
- Join Date
- Sep 2009
- Location
- Melbourne, Australia
- Posts
- 228
- Mentioned
- 1 Post(s)
- Tagged
- 0 Thread(s)
You don't see anything?
You should see something like:
** Starting Mongrel listening at 0.0.0.0:3000
** Starting Rails with development environment...
** Rails loaded.
** Loading any Rails specific GemPlugins
** Signals ready. TERM => stop. USR2 => restart. INT => stop (no restart).
** Rails signals registered. HUP => reload (without restart). It might not work well.
** Mongrel 1.1.5 available at 0.0.0.0:3000
** Use CTRL-C to stop.
If you exit the terminal window the Mongrel server will stop, or you can interrupt it by pressing CTRL-C
-
Oct 6, 2009, 17:58 #5
- Join Date
- Oct 2009
- Posts
- 3
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
=> Booting Mongrel =>Rails 2.3.4 application starting on 0.0.0.0:3000 => Call with -d to detach => Ctrl -C to shutdown server This is it, and then a blinking cursor. It wont let me type. Do I just minimize the window and start a new one?
-
Oct 6, 2009, 18:08 #6
- Join Date
- Sep 2009
- Location
- Melbourne, Australia
- Posts
- 228
- Mentioned
- 1 Post(s)
- Tagged
- 0 Thread(s)
Oh, yeah. That terminal is running the mongrel server, so you can't do anything with it. However, you can start a mongrel server that's not "attached" to that terminal: that's what the "call with -d to detach" means.
So if you run:
ruby script/server -d
your mongrel server will start detached and your command prompt will be back. However if you want to stop that process you need to find it, which can be tricky if you're not used to that sort of thing. Usually the best is just to minimize that window and start another one if you want to do other things at the command line while your server is still running.
Bookmarks