관리-도구
편집 파일: M000425.html
<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>start (Rack::Server)</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" /> </head> <body class="standalone-code"> <pre><span class="ruby-comment cmt"># File lib/rack/server.rb, line 247</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">start</span> <span class="ruby-operator">&</span><span class="ruby-identifier">blk</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:warn</span>] <span class="ruby-identifier">$-w</span> = <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">end</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">includes</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:include</span>] <span class="ruby-identifier">$LOAD_PATH</span>.<span class="ruby-identifier">unshift</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">includes</span>) <span class="ruby-keyword kw">end</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">library</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:require</span>] <span class="ruby-identifier">require</span> <span class="ruby-identifier">library</span> <span class="ruby-keyword kw">end</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:debug</span>] <span class="ruby-identifier">$DEBUG</span> = <span class="ruby-keyword kw">true</span> <span class="ruby-identifier">require</span> <span class="ruby-value str">'pp'</span> <span class="ruby-identifier">p</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:server</span>] <span class="ruby-identifier">pp</span> <span class="ruby-identifier">wrapped_app</span> <span class="ruby-identifier">pp</span> <span class="ruby-identifier">app</span> <span class="ruby-keyword kw">end</span> <span class="ruby-identifier">check_pid!</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:pid</span>] <span class="ruby-comment cmt"># Touch the wrapped app, so that the config.ru is loaded before</span> <span class="ruby-comment cmt"># daemonization (i.e. before chdir, etc).</span> <span class="ruby-identifier">wrapped_app</span> <span class="ruby-identifier">daemonize_app</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:daemonize</span>] <span class="ruby-identifier">write_pid</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:pid</span>] <span class="ruby-identifier">trap</span>(<span class="ruby-identifier">:INT</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">server</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:shutdown</span>) <span class="ruby-identifier">server</span>.<span class="ruby-identifier">shutdown</span> <span class="ruby-keyword kw">else</span> <span class="ruby-identifier">exit</span> <span class="ruby-keyword kw">end</span> <span class="ruby-keyword kw">end</span> <span class="ruby-identifier">server</span>.<span class="ruby-identifier">run</span> <span class="ruby-identifier">wrapped_app</span>, <span class="ruby-identifier">options</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">blk</span> <span class="ruby-keyword kw">end</span></pre> </body> </html>