title: For ruby/webrick, I need windows to recognize shebang (#!) notation
body: <p>(Bear with me, I promise this gets to shebang and windows.)</p>
  
  <p>I have about the simplest of WEBRick servers put together:</p>
  
  <pre><code>require 'webrick'
  include WEBrick
  
  s = HTTPServer.new(:Port=&gt;2000, :DocumentRoot=&gt;Dir::pwd)
  s.start
  </code></pre>
  
  <p>Couldn't be simpler.  This basic server does accept http connections (firefox, internet exploder, wget, TELENT) and deals with them appropriately, as long as I'm just fetching static documents.  If, however, I set one of the files in the directory to have a .cgi extension, I get a 500 back and the following on the server's terminal:</p>
  
  <pre><code>ERROR CGIHandler: c:/rubyCGI/test.cgi: 
  C:/...[snip]...webrick/httpservlet/cgi_runner.rb:45: in 'exec': Exec format error - ...[snip]...
  </code></pre>
  
  <p>I've done a few things on the command line to mimic what is going on in line 45 of cgi_runner.rb</p>
  
  <pre><code>c:\&gt;ruby
  exec "c:/rubyCGI/test.cgi"
  ^Z
  (same error erupts)
  
  c:\&gt;ruby
  exec "ruby c:/rubyCGI/test.cgi"
  ^Z
  Content-type: text/html
  
  Mares eat oats and does eat oats and I'll be home for Christmas.
  </code></pre>
  
  <p>Clearly, WEBrick hasn't been cleared for landing on windows.  Your usual headaches of corporate paranoia prevent me from modifying webrick, so <strong>can I get the shebang notation in c:/rubyCGI/test.cgi recognized by the OS (windows) so I don't have to explicitly tell it each time which interpreter to use?</strong>  I could assign all .cgi files to be associated with ruby, but that would be limiting in the long run.</p>
  
  <p>UPDATE:
  Since posting this, it has occurred to me that it may not be possible at all to run a cgi web server from ruby; ruby has no forking support.  With no ability to fork a process, a cgi server would have to execute each cgi script one-at-a-time, neglecting all concurrent requests while the first one completed.  While this may be acceptable for some, it would not work for my application.  Nevertheless, I would still be very interested in an answer to my original question—that of getting shebang working under windows.</p>