| CODENOTIFIER | HelpYou are not signed inSign in |
Project: taskr
Revision: 212
Author: matt.zukowski
Date: 03 Jul 2008 13:59:11
Changes:Diff:| ... | ...@@ -44,6 +44,11 @@ | |
| 44 | 44 | if params[:dont_wait] |
| 45 | 45 | puts "Task #{params[:task_name].inspect} will be forked to its own process because the 'dont_wait' parameter was set to true." |
| 46 | 46 | |
| 47 | # Monkey-patch Mongrel to not remove its pid file in the child | |
| 48 | # See: http://geekblog.vodpod.com/?p=26 | |
| 49 | require 'mongrel' | |
| 50 | Mongrel::Configurator.class_eval("def remove_pid_file; puts 'child no-op'; end") | |
| 51 | ||
| 47 | 52 | pid = fork do |
| 48 | 53 | RAILS_DEFAULT_LOGGER.debug("*** Taskr4Rails -- Executing task #{params[:task_name].inspect} with Ruby code: #{params[:ruby_code]}") |
| 49 | 54 | eval(params[:ruby_code]) |
| ... | ...@@ -63,7 +68,7 @@ | |
| 63 | 68 | end |
| 64 | 69 | $stdout = prev_stdout |
| 65 | 70 | $stderr = prev_stderr |
| 66 | output = io.read(nil) | |
| 71 | output = io.string | |
| 67 | 72 | |
| 68 | 73 | render :text => output, :status => (err ? 500 : 200) |
| 69 | 74 | end |