thoughtworks/cruisecontrol.rb — Issue #89: Builder exists unexpectedly 
Author: crawlik
Created: 2012-01-20 17:23:23+00:00
State: open

We downloaded /thoughtworks-cruisecontrol.rb-422b3ee from https://github.com/thoughtworks/cruisecontrol.rb/downloads. Got it installed and running but some projects exist unexpectedly. Here is log trace from builder.log.

```
[fatal] Input/output error
[fatal] /home/X/cruise/app/models/polling_scheduler.rb:69:in `write'
[fatal] /home/X/cruise/app/models/polling_scheduler.rb:69:in `puts'
[fatal] /home/X/cruise/app/models/polling_scheduler.rb:69:in `log_error'
[fatal] /home/X/cruise/app/models/polling_scheduler.rb:20:in `run'
[fatal] /home/X/cruise/lib/cruise_control/../../script/builder:86
[fatal] /home/X/cruise/lib/cruise_control/../../script/builder:85:in `catch'
[fatal] /home/X/cruise/lib/cruise_control/../../script/builder:85
[fatal] /home/X/cruise/lib/cruise_control/init.rb:92:in `load'
[fatal] /home/X/cruise/lib/cruise_control/init.rb:92:in `builder'
[fatal] /home/X/cruise/lib/cruise_control/init.rb:12:in `send'
[fatal] /home/X/cruise/lib/cruise_control/init.rb:12:in `run'
[fatal] /home/X/cruise/cruise:10
[info] [2012-01-19 23:06:08] Builder for project 'Z' exited
```
Looks like there an exception which is not handled by this code in script/builder. Guys any recommendations what to do about it?

```ruby
begin
project = load_project(project_path)
startup(project)

write_to_log_and_console "Builder for project '#{project.name}' started"
puts "Logging to: #{File.expand_path(CRUISE_OPTIONS[:log_file_name])}"

while (true) do
catch(:reload_project) do
project.scheduler.run
end
project = load_project(project_path)
# this will cause the next call to scheduler to run the build immediately
project.request_build rescue nil
end
rescue Interrupt
# this is okay, we're just control-c'ing the app
rescue Exception => e
begin
CruiseControl::Log.fatal(e)
rescue => logging_error
STDERR.puts e.message
STDERR.puts e.backtrace.map { |line| " #{line}" }
STDERR.puts "Attempt to log the above error failed with this:"
STDERR.puts logging_error.message
STDERR.puts logging_error.backtrace
end
CRUISE_OPTIONS[:verbose] ? raise : exit(1)
ensure
cleanup(project)
end
```