From daa0ac2f018cbbc0d747982b754ae889f0cf4878 Mon Sep 17 00:00:00 2001 From: Nate Hardison Date: Wed, 22 May 2013 19:42:22 -0700 Subject: [PATCH] Capture Mako exit code and fail fast if necessary Capture the exit code of the Mako template engine invocation on asset preprocessing and abort from the Rake task on failure. This will prevent the LMS from continuing its attempt to start up, preventing further configuration errors. --- rakefiles/assets.rake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rakefiles/assets.rake b/rakefiles/assets.rake index b7edaa1b02..c0757b712b 100644 --- a/rakefiles/assets.rake +++ b/rakefiles/assets.rake @@ -19,9 +19,11 @@ def preprocess_with_mako(filename) # strip off the .mako extension output_filename = filename.chomp(File.extname(filename)) - # just pipe from stdout into the new file + # just pipe from stdout into the new file, exiting on failure File.open(output_filename, 'w') do |file| file.write(`python -c '#{mako}'`) + exit_code = $?.to_i + abort "#{mako} failed with #{exit_code}" if exit_code.to_i != 0 end end