title: Sinatra executing ls on sever side
body: <p>I am trying to show in Chrome using Sinatra, the result of <code>ls</code>. But the explorer gets in an "Connecting..." loop.</p>
  
  <p>My code is:</p>
  
  <pre><code>require 'rubygems' if RUBY_VERSION &lt; "1.9"
  require 'sinatra/base'
  
  #This is the webservice to launch the gamma project
  #Using Request at the principal webpage
  class MyApp &lt; Sinatra::Base
    get '/' do
      result = exec "ls"
      puts result 
    end   
  end
  </code></pre>
  
  <p>I am not sure of that <code>puts</code>, I think that maybe is not the apropiate method. What could be happening and how can I solve it? </p>
  
  <p>PS: In the explorer I used <code>localhost.com:4567/</code></p>