passenger 2.2.4 → 2.2.5

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of passenger might be problematic. Click here for more details.

Files changed (105) hide show
  1. data/NEWS +137 -0
  2. data/Rakefile +101 -19
  3. data/bin/passenger-install-nginx-module +10 -3
  4. data/bin/passenger-make-enterprisey +1 -1
  5. data/doc/Users guide Apache.html +227 -92
  6. data/doc/Users guide Apache.txt +169 -75
  7. data/doc/Users guide Nginx.html +1 -1
  8. data/doc/cxxapi/Bucket_8h-source.html +1 -1
  9. data/doc/cxxapi/Configuration_8h-source.html +373 -338
  10. data/doc/cxxapi/DirectoryMapper_8h-source.html +1 -1
  11. data/doc/cxxapi/Hooks_8h-source.html +1 -1
  12. data/doc/cxxapi/annotated.html +1 -1
  13. data/doc/cxxapi/classHooks-members.html +1 -1
  14. data/doc/cxxapi/classHooks.html +2 -2
  15. data/doc/cxxapi/classPassenger_1_1DirectoryMapper-members.html +1 -1
  16. data/doc/cxxapi/classPassenger_1_1DirectoryMapper.html +1 -1
  17. data/doc/cxxapi/classes.html +1 -1
  18. data/doc/cxxapi/definitions_8h-source.html +1 -1
  19. data/doc/cxxapi/files.html +1 -1
  20. data/doc/cxxapi/functions.html +1 -1
  21. data/doc/cxxapi/functions_func.html +1 -1
  22. data/doc/cxxapi/graph_legend.html +1 -1
  23. data/doc/cxxapi/group__Configuration.html +1 -1
  24. data/doc/cxxapi/group__Core.html +1 -1
  25. data/doc/cxxapi/group__Hooks.html +1 -1
  26. data/doc/cxxapi/group__Support.html +1 -1
  27. data/doc/cxxapi/main.html +1 -1
  28. data/doc/cxxapi/modules.html +1 -1
  29. data/doc/rdoc/classes/ConditionVariable.html +59 -59
  30. data/doc/rdoc/classes/Exception.html +11 -11
  31. data/doc/rdoc/classes/GC.html +4 -4
  32. data/doc/rdoc/classes/IO.html +14 -14
  33. data/doc/rdoc/classes/PhusionPassenger.html +1 -1
  34. data/doc/rdoc/classes/PhusionPassenger/AbstractInstaller.html +8 -8
  35. data/doc/rdoc/classes/PhusionPassenger/AbstractRequestHandler.html +136 -136
  36. data/doc/rdoc/classes/PhusionPassenger/AbstractServer.html +254 -254
  37. data/doc/rdoc/classes/PhusionPassenger/AbstractServerCollection.html +61 -61
  38. data/doc/rdoc/classes/PhusionPassenger/AppInitError.html +4 -4
  39. data/doc/rdoc/classes/PhusionPassenger/Application.html +14 -14
  40. data/doc/rdoc/classes/PhusionPassenger/ConsoleTextTemplate.html +12 -12
  41. data/doc/rdoc/classes/PhusionPassenger/FrameworkInitError.html +4 -4
  42. data/doc/rdoc/classes/PhusionPassenger/HTMLTemplate.html +12 -12
  43. data/doc/rdoc/classes/PhusionPassenger/InitializationError.html +5 -5
  44. data/doc/rdoc/classes/PhusionPassenger/MessageChannel.html +139 -139
  45. data/doc/rdoc/classes/PhusionPassenger/Rack/RequestHandler.html +61 -56
  46. data/doc/rdoc/classes/PhusionPassenger/Railz/ApplicationSpawner.html +3 -3
  47. data/doc/rdoc/classes/PhusionPassenger/Railz/FrameworkSpawner.html +7 -7
  48. data/doc/rdoc/classes/PhusionPassenger/Railz/RequestHandler.html +15 -15
  49. data/doc/rdoc/classes/PhusionPassenger/SpawnManager.html +119 -119
  50. data/doc/rdoc/classes/PhusionPassenger/UnknownError.html +4 -4
  51. data/doc/rdoc/classes/PhusionPassenger/Utils.html +310 -312
  52. data/doc/rdoc/classes/PhusionPassenger/Utils/PseudoIO.html +169 -0
  53. data/doc/rdoc/classes/PhusionPassenger/VersionNotFound.html +4 -4
  54. data/doc/rdoc/classes/PlatformInfo.html +165 -164
  55. data/doc/rdoc/classes/Signal.html +23 -23
  56. data/doc/rdoc/created.rid +1 -1
  57. data/doc/rdoc/files/ext/phusion_passenger/native_support_c.html +1 -1
  58. data/doc/rdoc/files/lib/phusion_passenger/abstract_request_handler_rb.html +26 -28
  59. data/doc/rdoc/files/lib/phusion_passenger/abstract_server_rb.html +26 -28
  60. data/doc/rdoc/files/lib/phusion_passenger/admin_tools/control_process_rb.html +1 -1
  61. data/doc/rdoc/files/lib/phusion_passenger/constants_rb.html +1 -1
  62. data/doc/rdoc/files/lib/phusion_passenger/message_channel_rb.html +26 -28
  63. data/doc/rdoc/files/lib/phusion_passenger/platform_info_rb.html +1 -1
  64. data/doc/rdoc/files/lib/phusion_passenger/rack/application_spawner_rb.html +1 -1
  65. data/doc/rdoc/files/lib/phusion_passenger/rack/request_handler_rb.html +26 -28
  66. data/doc/rdoc/files/lib/phusion_passenger/railz/application_spawner_rb.html +1 -2
  67. data/doc/rdoc/files/lib/phusion_passenger/railz/framework_spawner_rb.html +1 -1
  68. data/doc/rdoc/files/lib/phusion_passenger/railz/request_handler_rb.html +26 -28
  69. data/doc/rdoc/files/lib/phusion_passenger/spawn_manager_rb.html +26 -28
  70. data/doc/rdoc/files/lib/phusion_passenger/utils_rb.html +34 -36
  71. data/doc/rdoc/fr_class_index.html +1 -0
  72. data/doc/rdoc/fr_method_index.html +72 -68
  73. data/ext/apache2/Configuration.cpp +69 -15
  74. data/ext/apache2/Configuration.h +37 -2
  75. data/ext/apache2/Hooks.cpp +167 -59
  76. data/ext/common/ApplicationPoolServerExecutable.cpp +1 -1
  77. data/ext/common/MessageChannel.h +4 -4
  78. data/ext/common/StandardApplicationPool.h +1 -1
  79. data/ext/common/Timer.h +2 -0
  80. data/ext/common/Version.h +1 -1
  81. data/ext/nginx/Configuration.c +3 -3
  82. data/ext/nginx/ContentHandler.c +16 -4
  83. data/ext/nginx/HelperServer.cpp +1 -1
  84. data/ext/oxt/system_calls.cpp +6 -1
  85. data/ext/oxt/thread.hpp +17 -2
  86. data/ext/phusion_passenger/native_support.c +4 -4
  87. data/lib/phusion_passenger/abstract_request_handler.rb +3 -3
  88. data/lib/phusion_passenger/abstract_server.rb +1 -0
  89. data/lib/phusion_passenger/constants.rb +1 -1
  90. data/lib/phusion_passenger/message_channel.rb +1 -0
  91. data/lib/phusion_passenger/platform_info.rb +3 -2
  92. data/lib/phusion_passenger/rack/request_handler.rb +11 -7
  93. data/lib/phusion_passenger/railz/application_spawner.rb +7 -4
  94. data/lib/phusion_passenger/railz/request_handler.rb +1 -0
  95. data/lib/phusion_passenger/spawn_manager.rb +1 -0
  96. data/lib/phusion_passenger/utils.rb +38 -20
  97. data/test/integration_tests/apache2_tests.rb +162 -100
  98. data/test/integration_tests/mycook_spec.rb +63 -62
  99. data/test/integration_tests/nginx_tests.rb +12 -5
  100. data/test/ruby/utils_spec.rb +98 -14
  101. data/test/stub/apache2/httpd.conf.erb +2 -1
  102. data/test/stub/rails_apps/mycook/app/controllers/welcome_controller.rb +8 -0
  103. data/test/support/apache2_controller.rb +5 -1
  104. data/test/support/test_helper.rb +42 -13
  105. metadata +7 -137
@@ -80,7 +80,7 @@ StandardError
80
80
 
81
81
  <div class="sectiontitle">Methods</div>
82
82
  <ul>
83
- <li><a href="#M000125">new</a></li>
83
+ <li><a href="#M000129">new</a></li>
84
84
  </ul>
85
85
 
86
86
 
@@ -101,11 +101,11 @@ StandardError
101
101
  <div class="sectiontitle">Public Class methods</div>
102
102
  <div class="method">
103
103
  <div class="title">
104
- <a name="M000125"></a><b>new</b>(message, class_name, backtrace)
104
+ <a name="M000129"></a><b>new</b>(message, class_name, backtrace)
105
105
  </div>
106
106
  <div class="sourcecode">
107
- <p class="source-link">[ <a href="javascript:toggleSource('M000125_source')" id="l_M000125_source">show source</a> ]</p>
108
- <div id="M000125_source" class="dyn-source">
107
+ <p class="source-link">[ <a href="javascript:toggleSource('M000129_source')" id="l_M000129_source">show source</a> ]</p>
108
+ <div id="M000129_source" class="dyn-source">
109
109
  <pre>
110
110
  <span class="ruby-comment cmt"># File lib/phusion_passenger/exceptions.rb, line 93</span>
111
111
  93: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">message</span>, <span class="ruby-identifier">class_name</span>, <span class="ruby-identifier">backtrace</span>)
@@ -102,6 +102,9 @@ Utility functions.
102
102
 
103
103
 
104
104
 
105
+ <div class="sectiontitle">Classes and Modules</div>
106
+ Class <a href="Utils/PseudoIO.html" class="link">PhusionPassenger::Utils::PseudoIO</a><br />
107
+
105
108
 
106
109
 
107
110
 
@@ -121,24 +124,24 @@ directory if it doesn&#8216;t exist.
121
124
  <p class="source-link">[ <a href="javascript:toggleSource('M000092_source')" id="l_M000092_source">show source</a> ]</p>
122
125
  <div id="M000092_source" class="dyn-source">
123
126
  <pre>
124
- <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 402</span>
125
- 402: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">passenger_tmpdir</span>(<span class="ruby-identifier">create</span> = <span class="ruby-keyword kw">true</span>)
126
- 403: <span class="ruby-identifier">dir</span> = <span class="ruby-ivar">@@passenger_tmpdir</span>
127
- 404: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">dir</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">dir</span>.<span class="ruby-identifier">empty?</span>
128
- 405: <span class="ruby-identifier">dir</span> = <span class="ruby-node">&quot;#{Dir.tmpdir}/passenger.#{Process.pid}&quot;</span>
129
- 406: <span class="ruby-ivar">@@passenger_tmpdir</span> = <span class="ruby-identifier">dir</span>
130
- 407: <span class="ruby-keyword kw">end</span>
131
- 408: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">create</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">dir</span>)
132
- 409: <span class="ruby-comment cmt"># This is a very minimal implementation of the function</span>
133
- 410: <span class="ruby-comment cmt"># passengerCreateTempDir() in Utils.cpp. This implementation</span>
134
- 411: <span class="ruby-comment cmt"># is only meant to make the unit tests pass. For production</span>
135
- 412: <span class="ruby-comment cmt"># systems one should pre-create the temp directory with</span>
136
- 413: <span class="ruby-comment cmt"># passengerCreateTempDir().</span>
137
- 414: <span class="ruby-identifier">system</span>(<span class="ruby-value str">&quot;mkdir&quot;</span>, <span class="ruby-value str">&quot;-p&quot;</span>, <span class="ruby-value str">&quot;-m&quot;</span>, <span class="ruby-value str">&quot;u=wxs,g=wx,o=wx&quot;</span>, <span class="ruby-identifier">dir</span>)
138
- 415: <span class="ruby-identifier">system</span>(<span class="ruby-value str">&quot;mkdir&quot;</span>, <span class="ruby-value str">&quot;-p&quot;</span>, <span class="ruby-value str">&quot;-m&quot;</span>, <span class="ruby-value str">&quot;u=wxs,g=wx,o=wx&quot;</span>, <span class="ruby-node">&quot;#{dir}/backends&quot;</span>)
139
- 416: <span class="ruby-keyword kw">end</span>
140
- 417: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">dir</span>
141
- 418: <span class="ruby-keyword kw">end</span>
127
+ <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 420</span>
128
+ 420: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">passenger_tmpdir</span>(<span class="ruby-identifier">create</span> = <span class="ruby-keyword kw">true</span>)
129
+ 421: <span class="ruby-identifier">dir</span> = <span class="ruby-ivar">@@passenger_tmpdir</span>
130
+ 422: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">dir</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">dir</span>.<span class="ruby-identifier">empty?</span>
131
+ 423: <span class="ruby-identifier">dir</span> = <span class="ruby-node">&quot;#{Dir.tmpdir}/passenger.#{Process.pid}&quot;</span>
132
+ 424: <span class="ruby-ivar">@@passenger_tmpdir</span> = <span class="ruby-identifier">dir</span>
133
+ 425: <span class="ruby-keyword kw">end</span>
134
+ 426: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">create</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">dir</span>)
135
+ 427: <span class="ruby-comment cmt"># This is a very minimal implementation of the function</span>
136
+ 428: <span class="ruby-comment cmt"># passengerCreateTempDir() in Utils.cpp. This implementation</span>
137
+ 429: <span class="ruby-comment cmt"># is only meant to make the unit tests pass. For production</span>
138
+ 430: <span class="ruby-comment cmt"># systems one should pre-create the temp directory with</span>
139
+ 431: <span class="ruby-comment cmt"># passengerCreateTempDir().</span>
140
+ 432: <span class="ruby-identifier">system</span>(<span class="ruby-value str">&quot;mkdir&quot;</span>, <span class="ruby-value str">&quot;-p&quot;</span>, <span class="ruby-value str">&quot;-m&quot;</span>, <span class="ruby-value str">&quot;u=wxs,g=wx,o=wx&quot;</span>, <span class="ruby-identifier">dir</span>)
141
+ 433: <span class="ruby-identifier">system</span>(<span class="ruby-value str">&quot;mkdir&quot;</span>, <span class="ruby-value str">&quot;-p&quot;</span>, <span class="ruby-value str">&quot;-m&quot;</span>, <span class="ruby-value str">&quot;u=wxs,g=wx,o=wx&quot;</span>, <span class="ruby-node">&quot;#{dir}/backends&quot;</span>)
142
+ 434: <span class="ruby-keyword kw">end</span>
143
+ 435: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">dir</span>
144
+ 436: <span class="ruby-keyword kw">end</span>
142
145
  </pre>
143
146
  </div>
144
147
  </div>
@@ -151,10 +154,10 @@ directory if it doesn&#8216;t exist.
151
154
  <p class="source-link">[ <a href="javascript:toggleSource('M000093_source')" id="l_M000093_source">show source</a> ]</p>
152
155
  <div id="M000093_source" class="dyn-source">
153
156
  <pre>
154
- <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 420</span>
155
- 420: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">passenger_tmpdir=</span>(<span class="ruby-identifier">dir</span>)
156
- 421: <span class="ruby-ivar">@@passenger_tmpdir</span> = <span class="ruby-identifier">dir</span>
157
- 422: <span class="ruby-keyword kw">end</span>
157
+ <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 438</span>
158
+ 438: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">passenger_tmpdir=</span>(<span class="ruby-identifier">dir</span>)
159
+ 439: <span class="ruby-ivar">@@passenger_tmpdir</span> = <span class="ruby-identifier">dir</span>
160
+ 440: <span class="ruby-keyword kw">end</span>
158
161
  </pre>
159
162
  </div>
160
163
  </div>
@@ -174,11 +177,11 @@ Raises <a href="InvalidPath.html">InvalidPath</a> if that is not the case.
174
177
  <p class="source-link">[ <a href="javascript:toggleSource('M000075_source')" id="l_M000075_source">show source</a> ]</p>
175
178
  <div id="M000075_source" class="dyn-source">
176
179
  <pre>
177
- <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 59</span>
178
- 59: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">assert_valid_app_root</span>(<span class="ruby-identifier">app_root</span>)
179
- 60: <span class="ruby-identifier">assert_valid_directory</span>(<span class="ruby-identifier">app_root</span>)
180
- 61: <span class="ruby-identifier">assert_valid_file</span>(<span class="ruby-node">&quot;#{app_root}/config/environment.rb&quot;</span>)
181
- 62: <span class="ruby-keyword kw">end</span>
180
+ <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 60</span>
181
+ 60: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">assert_valid_app_root</span>(<span class="ruby-identifier">app_root</span>)
182
+ 61: <span class="ruby-identifier">assert_valid_directory</span>(<span class="ruby-identifier">app_root</span>)
183
+ 62: <span class="ruby-identifier">assert_valid_file</span>(<span class="ruby-node">&quot;#{app_root}/config/environment.rb&quot;</span>)
184
+ 63: <span class="ruby-keyword kw">end</span>
182
185
  </pre>
183
186
  </div>
184
187
  </div>
@@ -197,12 +200,12 @@ href="InvalidPath.html">InvalidPath</a></tt> if it isn&#8216;t.
197
200
  <p class="source-link">[ <a href="javascript:toggleSource('M000076_source')" id="l_M000076_source">show source</a> ]</p>
198
201
  <div id="M000076_source" class="dyn-source">
199
202
  <pre>
200
- <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 65</span>
201
- 65: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">assert_valid_directory</span>(<span class="ruby-identifier">path</span>)
202
- 66: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">directory?</span>(<span class="ruby-identifier">path</span>)
203
- 67: <span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidPath</span>, <span class="ruby-node">&quot;'#{path}' is not a valid directory.&quot;</span>
204
- 68: <span class="ruby-keyword kw">end</span>
205
- 69: <span class="ruby-keyword kw">end</span>
203
+ <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 66</span>
204
+ 66: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">assert_valid_directory</span>(<span class="ruby-identifier">path</span>)
205
+ 67: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">directory?</span>(<span class="ruby-identifier">path</span>)
206
+ 68: <span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidPath</span>, <span class="ruby-node">&quot;'#{path}' is not a valid directory.&quot;</span>
207
+ 69: <span class="ruby-keyword kw">end</span>
208
+ 70: <span class="ruby-keyword kw">end</span>
206
209
  </pre>
207
210
  </div>
208
211
  </div>
@@ -221,12 +224,12 @@ href="InvalidPath.html">InvalidPath</a></tt> if it isn&#8216;t.
221
224
  <p class="source-link">[ <a href="javascript:toggleSource('M000077_source')" id="l_M000077_source">show source</a> ]</p>
222
225
  <div id="M000077_source" class="dyn-source">
223
226
  <pre>
224
- <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 72</span>
225
- 72: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">assert_valid_file</span>(<span class="ruby-identifier">path</span>)
226
- 73: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">file?</span>(<span class="ruby-identifier">path</span>)
227
- 74: <span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidPath</span>, <span class="ruby-node">&quot;'#{path}' is not a valid file.&quot;</span>
228
- 75: <span class="ruby-keyword kw">end</span>
229
- 76: <span class="ruby-keyword kw">end</span>
227
+ <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 73</span>
228
+ 73: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">assert_valid_file</span>(<span class="ruby-identifier">path</span>)
229
+ 74: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">file?</span>(<span class="ruby-identifier">path</span>)
230
+ 75: <span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidPath</span>, <span class="ruby-node">&quot;'#{path}' is not a valid file.&quot;</span>
231
+ 76: <span class="ruby-keyword kw">end</span>
232
+ 77: <span class="ruby-keyword kw">end</span>
230
233
  </pre>
231
234
  </div>
232
235
  </div>
@@ -245,11 +248,11 @@ if that is not the case.
245
248
  <p class="source-link">[ <a href="javascript:toggleSource('M000079_source')" id="l_M000079_source">show source</a> ]</p>
246
249
  <div id="M000079_source" class="dyn-source">
247
250
  <pre>
248
- <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 87</span>
249
- 87: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">assert_valid_groupname</span>(<span class="ruby-identifier">groupname</span>)
250
- 88: <span class="ruby-comment cmt"># If groupname does not exist then getgrnam() will raise an ArgumentError.</span>
251
- 89: <span class="ruby-identifier">groupname</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-constant">Etc</span>.<span class="ruby-identifier">getgrnam</span>(<span class="ruby-identifier">groupname</span>)
252
- 90: <span class="ruby-keyword kw">end</span>
251
+ <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 88</span>
252
+ 88: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">assert_valid_groupname</span>(<span class="ruby-identifier">groupname</span>)
253
+ 89: <span class="ruby-comment cmt"># If groupname does not exist then getgrnam() will raise an ArgumentError.</span>
254
+ 90: <span class="ruby-identifier">groupname</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-constant">Etc</span>.<span class="ruby-identifier">getgrnam</span>(<span class="ruby-identifier">groupname</span>)
255
+ 91: <span class="ruby-keyword kw">end</span>
253
256
  </pre>
254
257
  </div>
255
258
  </div>
@@ -268,11 +271,11 @@ that is not the case.
268
271
  <p class="source-link">[ <a href="javascript:toggleSource('M000078_source')" id="l_M000078_source">show source</a> ]</p>
269
272
  <div id="M000078_source" class="dyn-source">
270
273
  <pre>
271
- <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 80</span>
272
- 80: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">assert_valid_username</span>(<span class="ruby-identifier">username</span>)
273
- 81: <span class="ruby-comment cmt"># If username does not exist then getpwnam() will raise an ArgumentError.</span>
274
- 82: <span class="ruby-identifier">username</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-constant">Etc</span>.<span class="ruby-identifier">getpwnam</span>(<span class="ruby-identifier">username</span>)
275
- 83: <span class="ruby-keyword kw">end</span>
274
+ <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 81</span>
275
+ 81: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">assert_valid_username</span>(<span class="ruby-identifier">username</span>)
276
+ 82: <span class="ruby-comment cmt"># If username does not exist then getpwnam() will raise an ArgumentError.</span>
277
+ 83: <span class="ruby-identifier">username</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-constant">Etc</span>.<span class="ruby-identifier">getpwnam</span>(<span class="ruby-identifier">username</span>)
278
+ 84: <span class="ruby-keyword kw">end</span>
276
279
  </pre>
277
280
  </div>
278
281
  </div>
@@ -297,13 +300,13 @@ Raises SystemCallError if something went wrong. Raises ArgumentError if
297
300
  <p class="source-link">[ <a href="javascript:toggleSource('M000074_source')" id="l_M000074_source">show source</a> ]</p>
298
301
  <div id="M000074_source" class="dyn-source">
299
302
  <pre>
300
- <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 50</span>
301
- 50: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">canonicalize_path</span>(<span class="ruby-identifier">path</span>)
302
- 51: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">&quot;The 'path' argument may not be nil&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">path</span>.<span class="ruby-identifier">nil?</span>
303
- 52: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Pathname</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">path</span>).<span class="ruby-identifier">realpath</span>.<span class="ruby-identifier">to_s</span>
304
- 53: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ENOENT</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
305
- 54: <span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidAPath</span>, <span class="ruby-identifier">e</span>.<span class="ruby-identifier">message</span>
306
- 55: <span class="ruby-keyword kw">end</span>
303
+ <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 51</span>
304
+ 51: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">canonicalize_path</span>(<span class="ruby-identifier">path</span>)
305
+ 52: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">&quot;The 'path' argument may not be nil&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">path</span>.<span class="ruby-identifier">nil?</span>
306
+ 53: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Pathname</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">path</span>).<span class="ruby-identifier">realpath</span>.<span class="ruby-identifier">to_s</span>
307
+ 54: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ENOENT</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
308
+ 55: <span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidAPath</span>, <span class="ruby-identifier">e</span>.<span class="ruby-identifier">message</span>
309
+ 56: <span class="ruby-keyword kw">end</span>
307
310
  </pre>
308
311
  </div>
309
312
  </div>
@@ -316,17 +319,17 @@ Raises SystemCallError if something went wrong. Raises ArgumentError if
316
319
  <p class="source-link">[ <a href="javascript:toggleSource('M000080_source')" id="l_M000080_source">show source</a> ]</p>
317
320
  <div id="M000080_source" class="dyn-source">
318
321
  <pre>
319
- <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 92</span>
320
- 92: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">close_all_io_objects_for_fds</span>(<span class="ruby-identifier">file_descriptors_to_leave_open</span>)
321
- 93: <span class="ruby-constant">ObjectSpace</span>.<span class="ruby-identifier">each_object</span>(<span class="ruby-constant">IO</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">io</span><span class="ruby-operator">|</span>
322
- 94: <span class="ruby-keyword kw">begin</span>
323
- 95: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">file_descriptors_to_leave_open</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">io</span>.<span class="ruby-identifier">fileno</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-identifier">io</span>.<span class="ruby-identifier">closed?</span>
324
- 96: <span class="ruby-identifier">io</span>.<span class="ruby-identifier">close</span>
325
- 97: <span class="ruby-keyword kw">end</span>
326
- 98: <span class="ruby-keyword kw">rescue</span>
327
- 99: <span class="ruby-keyword kw">end</span>
328
- 100: <span class="ruby-keyword kw">end</span>
329
- 101: <span class="ruby-keyword kw">end</span>
322
+ <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 93</span>
323
+ 93: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">close_all_io_objects_for_fds</span>(<span class="ruby-identifier">file_descriptors_to_leave_open</span>)
324
+ 94: <span class="ruby-constant">ObjectSpace</span>.<span class="ruby-identifier">each_object</span>(<span class="ruby-constant">IO</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">io</span><span class="ruby-operator">|</span>
325
+ 95: <span class="ruby-keyword kw">begin</span>
326
+ 96: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">file_descriptors_to_leave_open</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">io</span>.<span class="ruby-identifier">fileno</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-identifier">io</span>.<span class="ruby-identifier">closed?</span>
327
+ 97: <span class="ruby-identifier">io</span>.<span class="ruby-identifier">close</span>
328
+ 98: <span class="ruby-keyword kw">end</span>
329
+ 99: <span class="ruby-keyword kw">rescue</span>
330
+ 100: <span class="ruby-keyword kw">end</span>
331
+ 101: <span class="ruby-keyword kw">end</span>
332
+ 102: <span class="ruby-keyword kw">end</span>
330
333
  </pre>
331
334
  </div>
332
335
  </div>
@@ -345,17 +348,17 @@ No exceptions will be raised in the event that privilege lowering fails.
345
348
  <p class="source-link">[ <a href="javascript:toggleSource('M000087_source')" id="l_M000087_source">show source</a> ]</p>
346
349
  <div id="M000087_source" class="dyn-source">
347
350
  <pre>
348
- <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 325</span>
349
- 325: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">lower_privilege</span>(<span class="ruby-identifier">filename</span>, <span class="ruby-identifier">lowest_user</span> = <span class="ruby-value str">&quot;nobody&quot;</span>)
350
- 326: <span class="ruby-identifier">stat</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">lstat</span>(<span class="ruby-identifier">filename</span>)
351
- 327: <span class="ruby-keyword kw">begin</span>
352
- 328: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">switch_to_user</span>(<span class="ruby-identifier">stat</span>.<span class="ruby-identifier">uid</span>)
353
- 329: <span class="ruby-identifier">switch_to_user</span>(<span class="ruby-identifier">lowest_user</span>)
354
- 330: <span class="ruby-keyword kw">end</span>
355
- 331: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">EPERM</span>
356
- 332: <span class="ruby-comment cmt"># No problem if we were unable to switch user.</span>
357
- 333: <span class="ruby-keyword kw">end</span>
358
- 334: <span class="ruby-keyword kw">end</span>
351
+ <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 343</span>
352
+ 343: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">lower_privilege</span>(<span class="ruby-identifier">filename</span>, <span class="ruby-identifier">lowest_user</span> = <span class="ruby-value str">&quot;nobody&quot;</span>)
353
+ 344: <span class="ruby-identifier">stat</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">lstat</span>(<span class="ruby-identifier">filename</span>)
354
+ 345: <span class="ruby-keyword kw">begin</span>
355
+ 346: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">switch_to_user</span>(<span class="ruby-identifier">stat</span>.<span class="ruby-identifier">uid</span>)
356
+ 347: <span class="ruby-identifier">switch_to_user</span>(<span class="ruby-identifier">lowest_user</span>)
357
+ 348: <span class="ruby-keyword kw">end</span>
358
+ 349: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">EPERM</span>
359
+ 350: <span class="ruby-comment cmt"># No problem if we were unable to switch user.</span>
360
+ 351: <span class="ruby-keyword kw">end</span>
361
+ 352: <span class="ruby-keyword kw">end</span>
359
362
  </pre>
360
363
  </div>
361
364
  </div>
@@ -368,29 +371,29 @@ No exceptions will be raised in the event that privilege lowering fails.
368
371
  <p class="source-link">[ <a href="javascript:toggleSource('M000081_source')" id="l_M000081_source">show source</a> ]</p>
369
372
  <div id="M000081_source" class="dyn-source">
370
373
  <pre>
371
- <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 103</span>
372
- 103: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">marshal_exception</span>(<span class="ruby-identifier">exception</span>)
373
- 104: <span class="ruby-identifier">data</span> = {
374
- 105: <span class="ruby-identifier">:message</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">exception</span>.<span class="ruby-identifier">message</span>,
375
- 106: <span class="ruby-identifier">:class</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">exception</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">to_s</span>,
376
- 107: <span class="ruby-identifier">:backtrace</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">exception</span>.<span class="ruby-identifier">backtrace</span>
377
- 108: }
378
- 109: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">exception</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">InitializationError</span>)
379
- 110: <span class="ruby-identifier">data</span>[<span class="ruby-identifier">:is_initialization_error</span>] = <span class="ruby-keyword kw">true</span>
380
- 111: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">exception</span>.<span class="ruby-identifier">child_exception</span>
381
- 112: <span class="ruby-identifier">data</span>[<span class="ruby-identifier">:child_exception</span>] = <span class="ruby-identifier">marshal_exception</span>(<span class="ruby-identifier">exception</span>.<span class="ruby-identifier">child_exception</span>)
382
- 113: <span class="ruby-keyword kw">end</span>
383
- 114: <span class="ruby-keyword kw">else</span>
384
- 115: <span class="ruby-keyword kw">begin</span>
385
- 116: <span class="ruby-identifier">data</span>[<span class="ruby-identifier">:exception</span>] = <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">dump</span>(<span class="ruby-identifier">exception</span>)
386
- 117: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-constant">TypeError</span>
387
- 118: <span class="ruby-identifier">e</span> = <span class="ruby-constant">UnknownError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">exception</span>.<span class="ruby-identifier">message</span>, <span class="ruby-identifier">exception</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">to_s</span>,
388
- 119: <span class="ruby-identifier">exception</span>.<span class="ruby-identifier">backtrace</span>)
389
- 120: <span class="ruby-identifier">data</span>[<span class="ruby-identifier">:exception</span>] = <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">dump</span>(<span class="ruby-identifier">e</span>)
390
- 121: <span class="ruby-keyword kw">end</span>
391
- 122: <span class="ruby-keyword kw">end</span>
392
- 123: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">dump</span>(<span class="ruby-identifier">data</span>)
393
- 124: <span class="ruby-keyword kw">end</span>
374
+ <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 104</span>
375
+ 104: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">marshal_exception</span>(<span class="ruby-identifier">exception</span>)
376
+ 105: <span class="ruby-identifier">data</span> = {
377
+ 106: <span class="ruby-identifier">:message</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">exception</span>.<span class="ruby-identifier">message</span>,
378
+ 107: <span class="ruby-identifier">:class</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">exception</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">to_s</span>,
379
+ 108: <span class="ruby-identifier">:backtrace</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">exception</span>.<span class="ruby-identifier">backtrace</span>
380
+ 109: }
381
+ 110: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">exception</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">InitializationError</span>)
382
+ 111: <span class="ruby-identifier">data</span>[<span class="ruby-identifier">:is_initialization_error</span>] = <span class="ruby-keyword kw">true</span>
383
+ 112: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">exception</span>.<span class="ruby-identifier">child_exception</span>
384
+ 113: <span class="ruby-identifier">data</span>[<span class="ruby-identifier">:child_exception</span>] = <span class="ruby-identifier">marshal_exception</span>(<span class="ruby-identifier">exception</span>.<span class="ruby-identifier">child_exception</span>)
385
+ 114: <span class="ruby-keyword kw">end</span>
386
+ 115: <span class="ruby-keyword kw">else</span>
387
+ 116: <span class="ruby-keyword kw">begin</span>
388
+ 117: <span class="ruby-identifier">data</span>[<span class="ruby-identifier">:exception</span>] = <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">dump</span>(<span class="ruby-identifier">exception</span>)
389
+ 118: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-constant">TypeError</span>
390
+ 119: <span class="ruby-identifier">e</span> = <span class="ruby-constant">UnknownError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">exception</span>.<span class="ruby-identifier">message</span>, <span class="ruby-identifier">exception</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">to_s</span>,
391
+ 120: <span class="ruby-identifier">exception</span>.<span class="ruby-identifier">backtrace</span>)
392
+ 121: <span class="ruby-identifier">data</span>[<span class="ruby-identifier">:exception</span>] = <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">dump</span>(<span class="ruby-identifier">e</span>)
393
+ 122: <span class="ruby-keyword kw">end</span>
394
+ 123: <span class="ruby-keyword kw">end</span>
395
+ 124: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">dump</span>(<span class="ruby-identifier">data</span>)
396
+ 125: <span class="ruby-keyword kw">end</span>
394
397
  </pre>
395
398
  </div>
396
399
  </div>
@@ -403,10 +406,10 @@ No exceptions will be raised in the event that privilege lowering fails.
403
406
  <p class="source-link">[ <a href="javascript:toggleSource('M000091_source')" id="l_M000091_source">show source</a> ]</p>
404
407
  <div id="M000091_source" class="dyn-source">
405
408
  <pre>
406
- <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 395</span>
407
- 395: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">passenger_tmpdir</span>(<span class="ruby-identifier">create</span> = <span class="ruby-keyword kw">true</span>)
408
- 396: <span class="ruby-constant">PhusionPassenger</span><span class="ruby-operator">::</span><span class="ruby-constant">Utils</span>.<span class="ruby-identifier">passenger_tmpdir</span>(<span class="ruby-identifier">create</span>)
409
- 397: <span class="ruby-keyword kw">end</span>
409
+ <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 413</span>
410
+ 413: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">passenger_tmpdir</span>(<span class="ruby-identifier">create</span> = <span class="ruby-keyword kw">true</span>)
411
+ 414: <span class="ruby-constant">PhusionPassenger</span><span class="ruby-operator">::</span><span class="ruby-constant">Utils</span>.<span class="ruby-identifier">passenger_tmpdir</span>(<span class="ruby-identifier">create</span>)
412
+ 415: <span class="ruby-keyword kw">end</span>
410
413
  </pre>
411
414
  </div>
412
415
  </div>
@@ -428,20 +431,20 @@ currently at. Usually the current class name will be enough.
428
431
  <p class="source-link">[ <a href="javascript:toggleSource('M000083_source')" id="l_M000083_source">show source</a> ]</p>
429
432
  <div id="M000083_source" class="dyn-source">
430
433
  <pre>
431
- <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 157</span>
432
- 157: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">print_exception</span>(<span class="ruby-identifier">current_location</span>, <span class="ruby-identifier">exception</span>, <span class="ruby-identifier">destination</span> = <span class="ruby-constant">STDERR</span>)
433
- 158: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">exception</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">SystemExit</span>)
434
- 159: <span class="ruby-identifier">destination</span>.<span class="ruby-identifier">puts</span>(<span class="ruby-identifier">exception</span>.<span class="ruby-identifier">backtrace_string</span>(<span class="ruby-identifier">current_location</span>))
435
- 160: <span class="ruby-identifier">destination</span>.<span class="ruby-identifier">flush</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">destination</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:flush</span>)
436
- 161: <span class="ruby-keyword kw">end</span>
437
- 162: <span class="ruby-keyword kw">end</span>
434
+ <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 158</span>
435
+ 158: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">print_exception</span>(<span class="ruby-identifier">current_location</span>, <span class="ruby-identifier">exception</span>, <span class="ruby-identifier">destination</span> = <span class="ruby-constant">STDERR</span>)
436
+ 159: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">exception</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">SystemExit</span>)
437
+ 160: <span class="ruby-identifier">destination</span>.<span class="ruby-identifier">puts</span>(<span class="ruby-identifier">exception</span>.<span class="ruby-identifier">backtrace_string</span>(<span class="ruby-identifier">current_location</span>))
438
+ 161: <span class="ruby-identifier">destination</span>.<span class="ruby-identifier">flush</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">destination</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:flush</span>)
439
+ 162: <span class="ruby-keyword kw">end</span>
440
+ 163: <span class="ruby-keyword kw">end</span>
438
441
  </pre>
439
442
  </div>
440
443
  </div>
441
444
  </div>
442
445
  <div class="method">
443
446
  <div class="title">
444
- <a name="M000085"></a><b>report_app_init_status</b>(channel, write_stderr_contents_to = STDERR) {|| ...}
447
+ <a name="M000085"></a><b>report_app_init_status</b>(channel, sink = STDERR) {|| ...}
445
448
  </div>
446
449
  <div class="description">
447
450
  <p>
@@ -450,12 +453,11 @@ href="MessageChannel.html">MessageChannel</a> object), telling the remote
450
453
  side whether the block raised an exception, called exit(), or succeeded.
451
454
  </p>
452
455
  <p>
453
- Anything written to $stderr and STDERR during execution of the block will
454
- be buffered. If <tt>write_stderr_contents_to</tt> is non-nil, then the
455
- buffered stderr data will be written to this object. In this case,
456
- <tt>write_stderr_contents_to</tt> must be an <a
457
- href="../IO.html">IO</a>-like object. If <tt>write_stderr_contents_to</tt>
458
- is nil, then the stder data will be discarded.
456
+ If <em>sink</em> is non-nil, then every operation on $stderr/STDERR inside
457
+ the block will be performed on <em>sink</em> as well. If <em>sink</em> is
458
+ nil then all operations on $stderr/STDERR inside the block will be silently
459
+ discarded, i.e. if one writes to $stderr/STDERR then nothing will be
460
+ actually written to the console.
459
461
  </p>
460
462
  <p>
461
463
  Returns whether the block succeeded, i.e. whether it didn&#8216;t raise an
@@ -471,48 +473,44 @@ that are propagated, only SystemExit will be reported.
471
473
  <p class="source-link">[ <a href="javascript:toggleSource('M000085_source')" id="l_M000085_source">show source</a> ]</p>
472
474
  <div id="M000085_source" class="dyn-source">
473
475
  <pre>
474
- <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 220</span>
475
- 220: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">report_app_init_status</span>(<span class="ruby-identifier">channel</span>, <span class="ruby-identifier">write_stderr_contents_to</span> = <span class="ruby-constant">STDERR</span>)
476
- 221: <span class="ruby-keyword kw">begin</span>
477
- 222: <span class="ruby-identifier">old_global_stderr</span> = <span class="ruby-identifier">$stderr</span>
478
- 223: <span class="ruby-identifier">old_stderr</span> = <span class="ruby-constant">STDERR</span>
479
- 224: <span class="ruby-identifier">stderr_output</span> = <span class="ruby-value str">&quot;&quot;</span>
480
- 225: <span class="ruby-identifier">tempfile</span> = <span class="ruby-constant">Tempfile</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'passenger-stderr'</span>)
481
- 226: <span class="ruby-identifier">tempfile</span>.<span class="ruby-identifier">unlink</span>
482
- 227: <span class="ruby-constant">Object</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">:remove_const</span>, <span class="ruby-value str">'STDERR'</span>) <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
483
- 228: <span class="ruby-constant">Object</span>.<span class="ruby-identifier">const_set</span>(<span class="ruby-value str">'STDERR'</span>, <span class="ruby-identifier">tempfile</span>)
484
- 229: <span class="ruby-keyword kw">begin</span>
485
- 230: <span class="ruby-keyword kw">yield</span>
486
- 231: <span class="ruby-keyword kw">ensure</span>
487
- 232: <span class="ruby-constant">Object</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">:remove_const</span>, <span class="ruby-value str">'STDERR'</span>) <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
488
- 233: <span class="ruby-constant">Object</span>.<span class="ruby-identifier">const_set</span>(<span class="ruby-value str">'STDERR'</span>, <span class="ruby-identifier">old_stderr</span>)
489
- 234: <span class="ruby-identifier">$stderr</span> = <span class="ruby-identifier">old_global_stderr</span>
490
- 235: <span class="ruby-identifier">tempfile</span>.<span class="ruby-identifier">rewind</span>
491
- 236: <span class="ruby-identifier">stderr_output</span> = <span class="ruby-identifier">tempfile</span>.<span class="ruby-identifier">read</span>
492
- 237: <span class="ruby-identifier">tempfile</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
493
- 238:
494
- 239: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">write_stderr_contents_to</span>
495
- 240: <span class="ruby-identifier">write_stderr_contents_to</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">stderr_output</span>)
496
- 241: <span class="ruby-identifier">write_stderr_contents_to</span>.<span class="ruby-identifier">flush</span>
497
- 242: <span class="ruby-keyword kw">end</span>
498
- 243: <span class="ruby-keyword kw">end</span>
499
- 244: <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">write</span>(<span class="ruby-value str">'success'</span>)
500
- 245: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
501
- 246: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">StandardError</span>, <span class="ruby-constant">ScriptError</span>, <span class="ruby-constant">NoMemoryError</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
502
- 247: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'TESTING_PASSENGER'</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">'1'</span>
503
- 248: <span class="ruby-identifier">print_exception</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">e</span>)
504
- 249: <span class="ruby-keyword kw">end</span>
505
- 250: <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">write</span>(<span class="ruby-value str">'exception'</span>)
506
- 251: <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">write_scalar</span>(<span class="ruby-identifier">marshal_exception</span>(<span class="ruby-identifier">e</span>))
507
- 252: <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">write_scalar</span>(<span class="ruby-identifier">stderr_output</span>)
508
- 253: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
509
- 254: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">SystemExit</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
510
- 255: <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">write</span>(<span class="ruby-value str">'exit'</span>)
511
- 256: <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">write_scalar</span>(<span class="ruby-identifier">marshal_exception</span>(<span class="ruby-identifier">e</span>))
512
- 257: <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">write_scalar</span>(<span class="ruby-identifier">stderr_output</span>)
513
- 258: <span class="ruby-identifier">raise</span>
514
- 259: <span class="ruby-keyword kw">end</span>
515
- 260: <span class="ruby-keyword kw">end</span>
476
+ <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 242</span>
477
+ 242: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">report_app_init_status</span>(<span class="ruby-identifier">channel</span>, <span class="ruby-identifier">sink</span> = <span class="ruby-constant">STDERR</span>)
478
+ 243: <span class="ruby-keyword kw">begin</span>
479
+ 244: <span class="ruby-identifier">old_global_stderr</span> = <span class="ruby-identifier">$stderr</span>
480
+ 245: <span class="ruby-identifier">old_stderr</span> = <span class="ruby-constant">STDERR</span>
481
+ 246: <span class="ruby-identifier">stderr_output</span> = <span class="ruby-value str">&quot;&quot;</span>
482
+ 247:
483
+ 248: <span class="ruby-identifier">pseudo_stderr</span> = <span class="ruby-constant">PseudoIO</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">sink</span>)
484
+ 249: <span class="ruby-constant">Object</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">:remove_const</span>, <span class="ruby-value str">'STDERR'</span>) <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
485
+ 250: <span class="ruby-constant">Object</span>.<span class="ruby-identifier">const_set</span>(<span class="ruby-value str">'STDERR'</span>, <span class="ruby-identifier">pseudo_stderr</span>)
486
+ 251: <span class="ruby-identifier">$stderr</span> = <span class="ruby-identifier">pseudo_stderr</span>
487
+ 252:
488
+ 253: <span class="ruby-keyword kw">begin</span>
489
+ 254: <span class="ruby-keyword kw">yield</span>
490
+ 255: <span class="ruby-keyword kw">ensure</span>
491
+ 256: <span class="ruby-constant">Object</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">:remove_const</span>, <span class="ruby-value str">'STDERR'</span>) <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
492
+ 257: <span class="ruby-constant">Object</span>.<span class="ruby-identifier">const_set</span>(<span class="ruby-value str">'STDERR'</span>, <span class="ruby-identifier">old_stderr</span>)
493
+ 258: <span class="ruby-identifier">$stderr</span> = <span class="ruby-identifier">old_global_stderr</span>
494
+ 259: <span class="ruby-identifier">stderr_output</span> = <span class="ruby-identifier">pseudo_stderr</span>.<span class="ruby-identifier">done!</span>
495
+ 260: <span class="ruby-keyword kw">end</span>
496
+ 261:
497
+ 262: <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">write</span>(<span class="ruby-value str">'success'</span>)
498
+ 263: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
499
+ 264: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">StandardError</span>, <span class="ruby-constant">ScriptError</span>, <span class="ruby-constant">NoMemoryError</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
500
+ 265: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'TESTING_PASSENGER'</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">'1'</span>
501
+ 266: <span class="ruby-identifier">print_exception</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">e</span>)
502
+ 267: <span class="ruby-keyword kw">end</span>
503
+ 268: <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">write</span>(<span class="ruby-value str">'exception'</span>)
504
+ 269: <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">write_scalar</span>(<span class="ruby-identifier">marshal_exception</span>(<span class="ruby-identifier">e</span>))
505
+ 270: <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">write_scalar</span>(<span class="ruby-identifier">stderr_output</span>)
506
+ 271: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
507
+ 272: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">SystemExit</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
508
+ 273: <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">write</span>(<span class="ruby-value str">'exit'</span>)
509
+ 274: <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">write_scalar</span>(<span class="ruby-identifier">marshal_exception</span>(<span class="ruby-identifier">e</span>))
510
+ 275: <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">write_scalar</span>(<span class="ruby-identifier">stderr_output</span>)
511
+ 276: <span class="ruby-identifier">raise</span>
512
+ 277: <span class="ruby-keyword kw">end</span>
513
+ 278: <span class="ruby-keyword kw">end</span>
516
514
  </pre>
517
515
  </div>
518
516
  </div>
@@ -541,35 +539,35 @@ the expense of not being able to waitpid() the second child.
541
539
  <p class="source-link">[ <a href="javascript:toggleSource('M000084_source')" id="l_M000084_source">show source</a> ]</p>
542
540
  <div id="M000084_source" class="dyn-source">
543
541
  <pre>
544
- <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 174</span>
545
- 174: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">safe_fork</span>(<span class="ruby-identifier">current_location</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>, <span class="ruby-identifier">double_fork</span> = <span class="ruby-keyword kw">false</span>)
546
- 175: <span class="ruby-identifier">pid</span> = <span class="ruby-identifier">fork</span>
547
- 176: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">pid</span>.<span class="ruby-identifier">nil?</span>
548
- 177: <span class="ruby-keyword kw">begin</span>
549
- 178: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">double_fork</span>
550
- 179: <span class="ruby-identifier">pid2</span> = <span class="ruby-identifier">fork</span>
551
- 180: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">pid2</span>.<span class="ruby-identifier">nil?</span>
552
- 181: <span class="ruby-identifier">srand</span>
553
- 182: <span class="ruby-keyword kw">yield</span>
554
- 183: <span class="ruby-keyword kw">end</span>
555
- 184: <span class="ruby-keyword kw">else</span>
556
- 185: <span class="ruby-identifier">srand</span>
557
- 186: <span class="ruby-keyword kw">yield</span>
558
- 187: <span class="ruby-keyword kw">end</span>
559
- 188: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
560
- 189: <span class="ruby-identifier">print_exception</span>(<span class="ruby-identifier">current_location</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">e</span>)
561
- 190: <span class="ruby-keyword kw">ensure</span>
562
- 191: <span class="ruby-identifier">exit!</span>
563
- 192: <span class="ruby-keyword kw">end</span>
564
- 193: <span class="ruby-keyword kw">else</span>
565
- 194: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">double_fork</span>
566
- 195: <span class="ruby-constant">Process</span>.<span class="ruby-identifier">waitpid</span>(<span class="ruby-identifier">pid</span>) <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
567
- 196: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">pid</span>
568
- 197: <span class="ruby-keyword kw">else</span>
569
- 198: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">pid</span>
570
- 199: <span class="ruby-keyword kw">end</span>
571
- 200: <span class="ruby-keyword kw">end</span>
572
- 201: <span class="ruby-keyword kw">end</span>
542
+ <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 175</span>
543
+ 175: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">safe_fork</span>(<span class="ruby-identifier">current_location</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>, <span class="ruby-identifier">double_fork</span> = <span class="ruby-keyword kw">false</span>)
544
+ 176: <span class="ruby-identifier">pid</span> = <span class="ruby-identifier">fork</span>
545
+ 177: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">pid</span>.<span class="ruby-identifier">nil?</span>
546
+ 178: <span class="ruby-keyword kw">begin</span>
547
+ 179: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">double_fork</span>
548
+ 180: <span class="ruby-identifier">pid2</span> = <span class="ruby-identifier">fork</span>
549
+ 181: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">pid2</span>.<span class="ruby-identifier">nil?</span>
550
+ 182: <span class="ruby-identifier">srand</span>
551
+ 183: <span class="ruby-keyword kw">yield</span>
552
+ 184: <span class="ruby-keyword kw">end</span>
553
+ 185: <span class="ruby-keyword kw">else</span>
554
+ 186: <span class="ruby-identifier">srand</span>
555
+ 187: <span class="ruby-keyword kw">yield</span>
556
+ 188: <span class="ruby-keyword kw">end</span>
557
+ 189: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
558
+ 190: <span class="ruby-identifier">print_exception</span>(<span class="ruby-identifier">current_location</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">e</span>)
559
+ 191: <span class="ruby-keyword kw">ensure</span>
560
+ 192: <span class="ruby-identifier">exit!</span>
561
+ 193: <span class="ruby-keyword kw">end</span>
562
+ 194: <span class="ruby-keyword kw">else</span>
563
+ 195: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">double_fork</span>
564
+ 196: <span class="ruby-constant">Process</span>.<span class="ruby-identifier">waitpid</span>(<span class="ruby-identifier">pid</span>) <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
565
+ 197: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">pid</span>
566
+ 198: <span class="ruby-keyword kw">else</span>
567
+ 199: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">pid</span>
568
+ 200: <span class="ruby-keyword kw">end</span>
569
+ 201: <span class="ruby-keyword kw">end</span>
570
+ 202: <span class="ruby-keyword kw">end</span>
573
571
  </pre>
574
572
  </div>
575
573
  </div>
@@ -582,26 +580,26 @@ the expense of not being able to waitpid() the second child.
582
580
  <p class="source-link">[ <a href="javascript:toggleSource('M000090_source')" id="l_M000090_source">show source</a> ]</p>
583
581
  <div id="M000090_source" class="dyn-source">
584
582
  <pre>
585
- <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 373</span>
586
- 373: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sanitize_spawn_options</span>(<span class="ruby-identifier">options</span>)
587
- 374: <span class="ruby-identifier">defaults</span> = {
588
- 375: <span class="ruby-value str">&quot;lower_privilege&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">true</span>,
589
- 376: <span class="ruby-value str">&quot;lowest_user&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;nobody&quot;</span>,
590
- 377: <span class="ruby-value str">&quot;environment&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;production&quot;</span>,
591
- 378: <span class="ruby-value str">&quot;app_type&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;rails&quot;</span>,
592
- 379: <span class="ruby-value str">&quot;spawn_method&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;smart-lv2&quot;</span>,
593
- 380: <span class="ruby-value str">&quot;framework_spawner_timeout&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">-1</span>,
594
- 381: <span class="ruby-value str">&quot;app_spawner_timeout&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">-1</span>,
595
- 382: <span class="ruby-value str">&quot;print_exceptions&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">true</span>
596
- 383: }
597
- 384: <span class="ruby-identifier">options</span> = <span class="ruby-identifier">defaults</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">options</span>)
598
- 385: <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;lower_privilege&quot;</span>] = <span class="ruby-identifier">to_boolean</span>(<span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;lower_privilege&quot;</span>])
599
- 386: <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;framework_spawner_timeout&quot;</span>] = <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;framework_spawner_timeout&quot;</span>].<span class="ruby-identifier">to_i</span>
600
- 387: <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;app_spawner_timeout&quot;</span>] = <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;app_spawner_timeout&quot;</span>].<span class="ruby-identifier">to_i</span>
601
- 388: <span class="ruby-comment cmt"># Force this to be a boolean for easy use with Utils#unmarshal_and_raise_errors.</span>
602
- 389: <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;print_exceptions&quot;</span>] = <span class="ruby-identifier">to_boolean</span>(<span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;print_exceptions&quot;</span>])
603
- 390: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">options</span>
604
- 391: <span class="ruby-keyword kw">end</span>
583
+ <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 391</span>
584
+ 391: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sanitize_spawn_options</span>(<span class="ruby-identifier">options</span>)
585
+ 392: <span class="ruby-identifier">defaults</span> = {
586
+ 393: <span class="ruby-value str">&quot;lower_privilege&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">true</span>,
587
+ 394: <span class="ruby-value str">&quot;lowest_user&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;nobody&quot;</span>,
588
+ 395: <span class="ruby-value str">&quot;environment&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;production&quot;</span>,
589
+ 396: <span class="ruby-value str">&quot;app_type&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;rails&quot;</span>,
590
+ 397: <span class="ruby-value str">&quot;spawn_method&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;smart-lv2&quot;</span>,
591
+ 398: <span class="ruby-value str">&quot;framework_spawner_timeout&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">-1</span>,
592
+ 399: <span class="ruby-value str">&quot;app_spawner_timeout&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">-1</span>,
593
+ 400: <span class="ruby-value str">&quot;print_exceptions&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">true</span>
594
+ 401: }
595
+ 402: <span class="ruby-identifier">options</span> = <span class="ruby-identifier">defaults</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">options</span>)
596
+ 403: <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;lower_privilege&quot;</span>] = <span class="ruby-identifier">to_boolean</span>(<span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;lower_privilege&quot;</span>])
597
+ 404: <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;framework_spawner_timeout&quot;</span>] = <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;framework_spawner_timeout&quot;</span>].<span class="ruby-identifier">to_i</span>
598
+ 405: <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;app_spawner_timeout&quot;</span>] = <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;app_spawner_timeout&quot;</span>].<span class="ruby-identifier">to_i</span>
599
+ 406: <span class="ruby-comment cmt"># Force this to be a boolean for easy use with Utils#unmarshal_and_raise_errors.</span>
600
+ 407: <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;print_exceptions&quot;</span>] = <span class="ruby-identifier">to_boolean</span>(<span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;print_exceptions&quot;</span>])
601
+ 408: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">options</span>
602
+ 409: <span class="ruby-keyword kw">end</span>
605
603
  </pre>
606
604
  </div>
607
605
  </div>
@@ -614,39 +612,39 @@ the expense of not being able to waitpid() the second child.
614
612
  <p class="source-link">[ <a href="javascript:toggleSource('M000088_source')" id="l_M000088_source">show source</a> ]</p>
615
613
  <div id="M000088_source" class="dyn-source">
616
614
  <pre>
617
- <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 336</span>
618
- 336: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">switch_to_user</span>(<span class="ruby-identifier">user</span>)
619
- 337: <span class="ruby-keyword kw">begin</span>
620
- 338: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">user</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>)
621
- 339: <span class="ruby-identifier">pw</span> = <span class="ruby-constant">Etc</span>.<span class="ruby-identifier">getpwnam</span>(<span class="ruby-identifier">user</span>)
622
- 340: <span class="ruby-identifier">username</span> = <span class="ruby-identifier">user</span>
623
- 341: <span class="ruby-identifier">uid</span> = <span class="ruby-identifier">pw</span>.<span class="ruby-identifier">uid</span>
624
- 342: <span class="ruby-identifier">gid</span> = <span class="ruby-identifier">pw</span>.<span class="ruby-identifier">gid</span>
625
- 343: <span class="ruby-keyword kw">else</span>
626
- 344: <span class="ruby-identifier">pw</span> = <span class="ruby-constant">Etc</span>.<span class="ruby-identifier">getpwuid</span>(<span class="ruby-identifier">user</span>)
627
- 345: <span class="ruby-identifier">username</span> = <span class="ruby-identifier">pw</span>.<span class="ruby-identifier">name</span>
628
- 346: <span class="ruby-identifier">uid</span> = <span class="ruby-identifier">user</span>
629
- 347: <span class="ruby-identifier">gid</span> = <span class="ruby-identifier">pw</span>.<span class="ruby-identifier">gid</span>
630
- 348: <span class="ruby-keyword kw">end</span>
631
- 349: <span class="ruby-keyword kw">rescue</span>
632
- 350: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
633
- 351: <span class="ruby-keyword kw">end</span>
634
- 352: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">uid</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
635
- 353: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
636
- 354: <span class="ruby-keyword kw">else</span>
637
- 355: <span class="ruby-comment cmt"># Some systems are broken. initgroups can fail because of</span>
638
- 356: <span class="ruby-comment cmt"># all kinds of stupid reasons. So we ignore any errors</span>
639
- 357: <span class="ruby-comment cmt"># raised by initgroups.</span>
640
- 358: <span class="ruby-keyword kw">begin</span>
641
- 359: <span class="ruby-constant">Process</span>.<span class="ruby-identifier">groups</span> = <span class="ruby-constant">Process</span>.<span class="ruby-identifier">initgroups</span>(<span class="ruby-identifier">username</span>, <span class="ruby-identifier">gid</span>)
642
- 360: <span class="ruby-keyword kw">rescue</span>
643
- 361: <span class="ruby-keyword kw">end</span>
644
- 362: <span class="ruby-constant">Process</span><span class="ruby-operator">::</span><span class="ruby-constant">Sys</span>.<span class="ruby-identifier">setgid</span>(<span class="ruby-identifier">gid</span>)
645
- 363: <span class="ruby-constant">Process</span><span class="ruby-operator">::</span><span class="ruby-constant">Sys</span>.<span class="ruby-identifier">setuid</span>(<span class="ruby-identifier">uid</span>)
646
- 364: <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'HOME'</span>] = <span class="ruby-identifier">pw</span>.<span class="ruby-identifier">dir</span>
647
- 365: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
648
- 366: <span class="ruby-keyword kw">end</span>
649
- 367: <span class="ruby-keyword kw">end</span>
615
+ <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 354</span>
616
+ 354: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">switch_to_user</span>(<span class="ruby-identifier">user</span>)
617
+ 355: <span class="ruby-keyword kw">begin</span>
618
+ 356: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">user</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>)
619
+ 357: <span class="ruby-identifier">pw</span> = <span class="ruby-constant">Etc</span>.<span class="ruby-identifier">getpwnam</span>(<span class="ruby-identifier">user</span>)
620
+ 358: <span class="ruby-identifier">username</span> = <span class="ruby-identifier">user</span>
621
+ 359: <span class="ruby-identifier">uid</span> = <span class="ruby-identifier">pw</span>.<span class="ruby-identifier">uid</span>
622
+ 360: <span class="ruby-identifier">gid</span> = <span class="ruby-identifier">pw</span>.<span class="ruby-identifier">gid</span>
623
+ 361: <span class="ruby-keyword kw">else</span>
624
+ 362: <span class="ruby-identifier">pw</span> = <span class="ruby-constant">Etc</span>.<span class="ruby-identifier">getpwuid</span>(<span class="ruby-identifier">user</span>)
625
+ 363: <span class="ruby-identifier">username</span> = <span class="ruby-identifier">pw</span>.<span class="ruby-identifier">name</span>
626
+ 364: <span class="ruby-identifier">uid</span> = <span class="ruby-identifier">user</span>
627
+ 365: <span class="ruby-identifier">gid</span> = <span class="ruby-identifier">pw</span>.<span class="ruby-identifier">gid</span>
628
+ 366: <span class="ruby-keyword kw">end</span>
629
+ 367: <span class="ruby-keyword kw">rescue</span>
630
+ 368: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
631
+ 369: <span class="ruby-keyword kw">end</span>
632
+ 370: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">uid</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
633
+ 371: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
634
+ 372: <span class="ruby-keyword kw">else</span>
635
+ 373: <span class="ruby-comment cmt"># Some systems are broken. initgroups can fail because of</span>
636
+ 374: <span class="ruby-comment cmt"># all kinds of stupid reasons. So we ignore any errors</span>
637
+ 375: <span class="ruby-comment cmt"># raised by initgroups.</span>
638
+ 376: <span class="ruby-keyword kw">begin</span>
639
+ 377: <span class="ruby-constant">Process</span>.<span class="ruby-identifier">groups</span> = <span class="ruby-constant">Process</span>.<span class="ruby-identifier">initgroups</span>(<span class="ruby-identifier">username</span>, <span class="ruby-identifier">gid</span>)
640
+ 378: <span class="ruby-keyword kw">rescue</span>
641
+ 379: <span class="ruby-keyword kw">end</span>
642
+ 380: <span class="ruby-constant">Process</span><span class="ruby-operator">::</span><span class="ruby-constant">Sys</span>.<span class="ruby-identifier">setgid</span>(<span class="ruby-identifier">gid</span>)
643
+ 381: <span class="ruby-constant">Process</span><span class="ruby-operator">::</span><span class="ruby-constant">Sys</span>.<span class="ruby-identifier">setuid</span>(<span class="ruby-identifier">uid</span>)
644
+ 382: <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'HOME'</span>] = <span class="ruby-identifier">pw</span>.<span class="ruby-identifier">dir</span>
645
+ 383: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
646
+ 384: <span class="ruby-keyword kw">end</span>
647
+ 385: <span class="ruby-keyword kw">end</span>
650
648
  </pre>
651
649
  </div>
652
650
  </div>
@@ -659,10 +657,10 @@ the expense of not being able to waitpid() the second child.
659
657
  <p class="source-link">[ <a href="javascript:toggleSource('M000089_source')" id="l_M000089_source">show source</a> ]</p>
660
658
  <div id="M000089_source" class="dyn-source">
661
659
  <pre>
662
- <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 369</span>
663
- 369: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_boolean</span>(<span class="ruby-identifier">value</span>)
664
- 370: <span class="ruby-keyword kw">return</span> <span class="ruby-operator">!</span>(<span class="ruby-identifier">value</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">value</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">false</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">value</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;false&quot;</span>)
665
- 371: <span class="ruby-keyword kw">end</span>
660
+ <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 387</span>
661
+ 387: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_boolean</span>(<span class="ruby-identifier">value</span>)
662
+ 388: <span class="ruby-keyword kw">return</span> <span class="ruby-operator">!</span>(<span class="ruby-identifier">value</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">value</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">false</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">value</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;false&quot;</span>)
663
+ 389: <span class="ruby-keyword kw">end</span>
666
664
  </pre>
667
665
  </div>
668
666
  </div>
@@ -715,45 +713,45 @@ occurred while receiving the information through the channel.
715
713
  <p class="source-link">[ <a href="javascript:toggleSource('M000086_source')" id="l_M000086_source">show source</a> ]</p>
716
714
  <div id="M000086_source" class="dyn-source">
717
715
  <pre>
718
- <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 284</span>
719
- 284: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unmarshal_and_raise_errors</span>(<span class="ruby-identifier">channel</span>, <span class="ruby-identifier">print_exception</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">app_type</span> = <span class="ruby-value str">&quot;rails&quot;</span>)
720
- 285: <span class="ruby-identifier">args</span> = <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">read</span>
721
- 286: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">nil?</span>
722
- 287: <span class="ruby-identifier">raise</span> <span class="ruby-constant">EOFError</span>, <span class="ruby-value str">&quot;Unexpected end-of-file detected.&quot;</span>
723
- 288: <span class="ruby-keyword kw">end</span>
724
- 289: <span class="ruby-identifier">status</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value">0</span>]
725
- 290: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">status</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'exception'</span>
726
- 291: <span class="ruby-identifier">child_exception</span> = <span class="ruby-identifier">unmarshal_exception</span>(<span class="ruby-identifier">channel</span>.<span class="ruby-identifier">read_scalar</span>)
727
- 292: <span class="ruby-identifier">stderr</span> = <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">read_scalar</span>
728
- 293: <span class="ruby-identifier">exception</span> = <span class="ruby-constant">AppInitError</span>.<span class="ruby-identifier">new</span>(
729
- 294: <span class="ruby-node">&quot;Application '#{@app_root}' raised an exception: &quot;</span> <span class="ruby-operator">&lt;&lt;</span>
730
- 295: <span class="ruby-node">&quot;#{child_exception.class} (#{child_exception.message})&quot;</span>,
731
- 296: <span class="ruby-identifier">child_exception</span>,
732
- 297: <span class="ruby-identifier">app_type</span>,
733
- 298: <span class="ruby-identifier">stderr</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-value">? </span><span class="ruby-keyword kw">nil</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">stderr</span>)
734
- 299: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">status</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'exit'</span>
735
- 300: <span class="ruby-identifier">child_exception</span> = <span class="ruby-identifier">unmarshal_exception</span>(<span class="ruby-identifier">channel</span>.<span class="ruby-identifier">read_scalar</span>)
736
- 301: <span class="ruby-identifier">stderr</span> = <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">read_scalar</span>
737
- 302: <span class="ruby-identifier">exception</span> = <span class="ruby-constant">AppInitError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;Application '#{@app_root}' exited during startup&quot;</span>,
738
- 303: <span class="ruby-identifier">child_exception</span>, <span class="ruby-identifier">app_type</span>, <span class="ruby-identifier">stderr</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-value">? </span><span class="ruby-keyword kw">nil</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">stderr</span>)
739
- 304: <span class="ruby-keyword kw">else</span>
740
- 305: <span class="ruby-identifier">exception</span> = <span class="ruby-keyword kw">nil</span>
716
+ <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 302</span>
717
+ 302: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unmarshal_and_raise_errors</span>(<span class="ruby-identifier">channel</span>, <span class="ruby-identifier">print_exception</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">app_type</span> = <span class="ruby-value str">&quot;rails&quot;</span>)
718
+ 303: <span class="ruby-identifier">args</span> = <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">read</span>
719
+ 304: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">nil?</span>
720
+ 305: <span class="ruby-identifier">raise</span> <span class="ruby-constant">EOFError</span>, <span class="ruby-value str">&quot;Unexpected end-of-file detected.&quot;</span>
741
721
  306: <span class="ruby-keyword kw">end</span>
742
- 307:
743
- 308: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">print_exception</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">exception</span>
744
- 309: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">print_exception</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:puts</span>)
745
- 310: <span class="ruby-identifier">print_exception</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">child_exception</span>, <span class="ruby-identifier">print_exception</span>)
746
- 311: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">print_exception</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:to_str</span>)
747
- 312: <span class="ruby-identifier">filename</span> = <span class="ruby-identifier">print_exception</span>.<span class="ruby-identifier">to_str</span>
748
- 313: <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">filename</span>, <span class="ruby-value str">'a'</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
749
- 314: <span class="ruby-identifier">print_exception</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">child_exception</span>, <span class="ruby-identifier">f</span>)
750
- 315: <span class="ruby-keyword kw">end</span>
751
- 316: <span class="ruby-keyword kw">else</span>
752
- 317: <span class="ruby-identifier">print_exception</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">child_exception</span>)
753
- 318: <span class="ruby-keyword kw">end</span>
754
- 319: <span class="ruby-keyword kw">end</span>
755
- 320: <span class="ruby-identifier">raise</span> <span class="ruby-identifier">exception</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">exception</span>
756
- 321: <span class="ruby-keyword kw">end</span>
722
+ 307: <span class="ruby-identifier">status</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value">0</span>]
723
+ 308: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">status</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'exception'</span>
724
+ 309: <span class="ruby-identifier">child_exception</span> = <span class="ruby-identifier">unmarshal_exception</span>(<span class="ruby-identifier">channel</span>.<span class="ruby-identifier">read_scalar</span>)
725
+ 310: <span class="ruby-identifier">stderr</span> = <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">read_scalar</span>
726
+ 311: <span class="ruby-identifier">exception</span> = <span class="ruby-constant">AppInitError</span>.<span class="ruby-identifier">new</span>(
727
+ 312: <span class="ruby-node">&quot;Application '#{@app_root}' raised an exception: &quot;</span> <span class="ruby-operator">&lt;&lt;</span>
728
+ 313: <span class="ruby-node">&quot;#{child_exception.class} (#{child_exception.message})&quot;</span>,
729
+ 314: <span class="ruby-identifier">child_exception</span>,
730
+ 315: <span class="ruby-identifier">app_type</span>,
731
+ 316: <span class="ruby-identifier">stderr</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-value">? </span><span class="ruby-keyword kw">nil</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">stderr</span>)
732
+ 317: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">status</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'exit'</span>
733
+ 318: <span class="ruby-identifier">child_exception</span> = <span class="ruby-identifier">unmarshal_exception</span>(<span class="ruby-identifier">channel</span>.<span class="ruby-identifier">read_scalar</span>)
734
+ 319: <span class="ruby-identifier">stderr</span> = <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">read_scalar</span>
735
+ 320: <span class="ruby-identifier">exception</span> = <span class="ruby-constant">AppInitError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;Application '#{@app_root}' exited during startup&quot;</span>,
736
+ 321: <span class="ruby-identifier">child_exception</span>, <span class="ruby-identifier">app_type</span>, <span class="ruby-identifier">stderr</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-value">? </span><span class="ruby-keyword kw">nil</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">stderr</span>)
737
+ 322: <span class="ruby-keyword kw">else</span>
738
+ 323: <span class="ruby-identifier">exception</span> = <span class="ruby-keyword kw">nil</span>
739
+ 324: <span class="ruby-keyword kw">end</span>
740
+ 325:
741
+ 326: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">print_exception</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">exception</span>
742
+ 327: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">print_exception</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:puts</span>)
743
+ 328: <span class="ruby-identifier">print_exception</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">child_exception</span>, <span class="ruby-identifier">print_exception</span>)
744
+ 329: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">print_exception</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:to_str</span>)
745
+ 330: <span class="ruby-identifier">filename</span> = <span class="ruby-identifier">print_exception</span>.<span class="ruby-identifier">to_str</span>
746
+ 331: <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">filename</span>, <span class="ruby-value str">'a'</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
747
+ 332: <span class="ruby-identifier">print_exception</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">child_exception</span>, <span class="ruby-identifier">f</span>)
748
+ 333: <span class="ruby-keyword kw">end</span>
749
+ 334: <span class="ruby-keyword kw">else</span>
750
+ 335: <span class="ruby-identifier">print_exception</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">child_exception</span>)
751
+ 336: <span class="ruby-keyword kw">end</span>
752
+ 337: <span class="ruby-keyword kw">end</span>
753
+ 338: <span class="ruby-identifier">raise</span> <span class="ruby-identifier">exception</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">exception</span>
754
+ 339: <span class="ruby-keyword kw">end</span>
757
755
  </pre>
758
756
  </div>
759
757
  </div>
@@ -766,33 +764,33 @@ occurred while receiving the information through the channel.
766
764
  <p class="source-link">[ <a href="javascript:toggleSource('M000082_source')" id="l_M000082_source">show source</a> ]</p>
767
765
  <div id="M000082_source" class="dyn-source">
768
766
  <pre>
769
- <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 126</span>
770
- 126: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unmarshal_exception</span>(<span class="ruby-identifier">data</span>)
771
- 127: <span class="ruby-identifier">hash</span> = <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">load</span>(<span class="ruby-identifier">data</span>)
772
- 128: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">hash</span>[<span class="ruby-identifier">:is_initialization_error</span>]
773
- 129: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">hash</span>[<span class="ruby-identifier">:child_exception</span>]
774
- 130: <span class="ruby-identifier">child_exception</span> = <span class="ruby-identifier">unmarshal_exception</span>(<span class="ruby-identifier">hash</span>[<span class="ruby-identifier">:child_exception</span>])
775
- 131: <span class="ruby-keyword kw">else</span>
776
- 132: <span class="ruby-identifier">child_exception</span> = <span class="ruby-keyword kw">nil</span>
777
- 133: <span class="ruby-keyword kw">end</span>
778
- 134:
779
- 135: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">hash</span>[<span class="ruby-identifier">:class</span>]
780
- 136: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">AppInitError</span>.<span class="ruby-identifier">to_s</span>
781
- 137: <span class="ruby-identifier">exception_class</span> = <span class="ruby-constant">AppInitError</span>
782
- 138: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">FrameworkInitError</span>.<span class="ruby-identifier">to_s</span>
783
- 139: <span class="ruby-identifier">exception_class</span> = <span class="ruby-constant">FrameworkInitError</span>
784
- 140: <span class="ruby-keyword kw">else</span>
785
- 141: <span class="ruby-identifier">exception_class</span> = <span class="ruby-constant">InitializationError</span>
786
- 142: <span class="ruby-keyword kw">end</span>
787
- 143: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">exception_class</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">hash</span>[<span class="ruby-identifier">:message</span>], <span class="ruby-identifier">child_exception</span>)
788
- 144: <span class="ruby-keyword kw">else</span>
789
- 145: <span class="ruby-keyword kw">begin</span>
790
- 146: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">load</span>(<span class="ruby-identifier">hash</span>[<span class="ruby-identifier">:exception</span>])
791
- 147: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-constant">TypeError</span>
792
- 148: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">UnknownError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">hash</span>[<span class="ruby-identifier">:message</span>], <span class="ruby-identifier">hash</span>[<span class="ruby-identifier">:class</span>], <span class="ruby-identifier">hash</span>[<span class="ruby-identifier">:backtrace</span>])
793
- 149: <span class="ruby-keyword kw">end</span>
794
- 150: <span class="ruby-keyword kw">end</span>
795
- 151: <span class="ruby-keyword kw">end</span>
767
+ <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 127</span>
768
+ 127: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unmarshal_exception</span>(<span class="ruby-identifier">data</span>)
769
+ 128: <span class="ruby-identifier">hash</span> = <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">load</span>(<span class="ruby-identifier">data</span>)
770
+ 129: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">hash</span>[<span class="ruby-identifier">:is_initialization_error</span>]
771
+ 130: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">hash</span>[<span class="ruby-identifier">:child_exception</span>]
772
+ 131: <span class="ruby-identifier">child_exception</span> = <span class="ruby-identifier">unmarshal_exception</span>(<span class="ruby-identifier">hash</span>[<span class="ruby-identifier">:child_exception</span>])
773
+ 132: <span class="ruby-keyword kw">else</span>
774
+ 133: <span class="ruby-identifier">child_exception</span> = <span class="ruby-keyword kw">nil</span>
775
+ 134: <span class="ruby-keyword kw">end</span>
776
+ 135:
777
+ 136: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">hash</span>[<span class="ruby-identifier">:class</span>]
778
+ 137: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">AppInitError</span>.<span class="ruby-identifier">to_s</span>
779
+ 138: <span class="ruby-identifier">exception_class</span> = <span class="ruby-constant">AppInitError</span>
780
+ 139: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">FrameworkInitError</span>.<span class="ruby-identifier">to_s</span>
781
+ 140: <span class="ruby-identifier">exception_class</span> = <span class="ruby-constant">FrameworkInitError</span>
782
+ 141: <span class="ruby-keyword kw">else</span>
783
+ 142: <span class="ruby-identifier">exception_class</span> = <span class="ruby-constant">InitializationError</span>
784
+ 143: <span class="ruby-keyword kw">end</span>
785
+ 144: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">exception_class</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">hash</span>[<span class="ruby-identifier">:message</span>], <span class="ruby-identifier">child_exception</span>)
786
+ 145: <span class="ruby-keyword kw">else</span>
787
+ 146: <span class="ruby-keyword kw">begin</span>
788
+ 147: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">load</span>(<span class="ruby-identifier">hash</span>[<span class="ruby-identifier">:exception</span>])
789
+ 148: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-constant">TypeError</span>
790
+ 149: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">UnknownError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">hash</span>[<span class="ruby-identifier">:message</span>], <span class="ruby-identifier">hash</span>[<span class="ruby-identifier">:class</span>], <span class="ruby-identifier">hash</span>[<span class="ruby-identifier">:backtrace</span>])
791
+ 150: <span class="ruby-keyword kw">end</span>
792
+ 151: <span class="ruby-keyword kw">end</span>
793
+ 152: <span class="ruby-keyword kw">end</span>
796
794
  </pre>
797
795
  </div>
798
796
  </div>