add error handling

This commit is contained in:
Sam 2013-11-26 14:12:07 +11:00
parent b2680b13a5
commit e926a41a14
1 changed files with 8 additions and 0 deletions

View File

@ -30,6 +30,9 @@ class DockerManager::Upgrader
else
log("Did not find unicorn launcher")
end
rescue
STDERR.puts("Docker Manager: FAILED TO UPGRADE")
raise
end
def run(cmd)
@ -37,6 +40,11 @@ class DockerManager::Upgrader
IO.popen("cd #{Rails.root} && #{cmd} 2>&1") do |line|
log(line.read)
end
unless $?.success?
STDERR.puts("FAILED: #{cmd}")
raise RuntimeError
end
end
def log(message)