WeBrick

Hello

what could I use to start and shutdown webrick from within a ruby script
an
not direclty from the command prompt. please Help

Thanks in advance

Hanan M. wrote:

Hello

what could I use to start and shutdown webrick from within a ruby script
an not direclty from the command prompt. please Help

Thanks in advance

There are some good examples here:

http://www.webrick.org/

I’m trying to start up webrick on my NT box.

irb(main):003:0> s = WEBrick::HTTPServer.new(:Port => 4567)
Errno::EBADF: Bad file descriptor
from c:/ruby/lib/ruby/1.8/webrick/log.rb:40:in write' from c:/ruby/lib/ruby/1.8/webrick/log.rb:40:in<<’
from c:/ruby/lib/ruby/1.8/webrick/log.rb:40:in log' from c:/ruby/lib/ruby/1.8/webrick/log.rb:85:inlog’
from c:/ruby/lib/ruby/1.8/webrick/log.rb:51:in info' from c:/ruby/lib/ruby/1.8/webrick/server.rb:55:ininitialize’
from c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:24:in initialize' from (irb):3:innew’
from (irb):3
from :0
irb(main):004:0>

I’ve tried a few other port numbers picked at random, but no joy. I also
get a similar problem if I just try to open up a TCP socket, so this
seems related:

irb(main):006:0> s = Socket::TCPServer.new(45673)
Errno::EBADF: Bad file descriptor
from (irb):6:in `write’
from (irb):6
from :0
irb(main):007:0>

Could anyone suggest what the problem is?

Thanks,
Benjohn

Oddly, none of this happens when I run directly from irb (I’ve not tried
a stand alone script). I’ve only encountered it when I’m using the fxri
interface, so I’m just using the vanila comand line.

Strange.

Thanks,
Benjohn