Skip to content

Instantly share code, notes, and snippets.

@jsvd
Created December 17, 2009 12:04
Show Gist options
  • Save jsvd/258704 to your computer and use it in GitHub Desktop.
Save jsvd/258704 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'sinatra/base'
class Web < Sinatra::Base
get '/' do
"hello"
end
end
thread = Thread.new do
Web.run!
end
sleep 10
thread.join
jsvd@wayreth ~ % ruby -v
ruby 1.8.7 (2009-04-08 patchlevel 160) [i386-freebsd8]
jsvd@wayreth ~ % gem list | grep sinatra
sinatra (0.9.4)
jsvd@wayreth ~ % ruby teste.rb
== Sinatra/0.9.4 has taken the stage on 4567 for development with backup from Mongrel
^C
== Sinatra has ended his set (crowd applauds)
^C
== Sinatra has ended his set (crowd applauds)
^C
== Sinatra has ended his set (crowd applauds)
jsvd@wayreth ~ %
require 'rubygems'
require 'sinatra/base'
class Web < Sinatra::Base
get '/' do
"hello"
end
end
thread = Thread.new do
Web.run!
trap(:INT) { exit }
end
sleep 10
thread.join
jsvd@wayreth ~ % ruby teste.rb
== Sinatra/0.9.4 has taken the stage on 4567 for development with backup from Mongrel
^C
== Sinatra has ended his set (crowd applauds)
^Cjsvd@wayreth ~ %
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment