From 44e28fdc1c7c6f6e921a9d7e2dfd22f633fe29be Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Wed, 17 Jul 2013 20:47:05 -0400 Subject: [PATCH] always print command that failed --- lib/rscons/environment.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/rscons/environment.rb b/lib/rscons/environment.rb index ba7cbef..5d7bd0a 100644 --- a/lib/rscons/environment.rb +++ b/lib/rscons/environment.rb @@ -120,12 +120,20 @@ module Rscons end def execute(short_desc, command) - if @varset[:echo] == :command + print_command = proc do puts command.map { |c| c =~ /\s/ ? "'#{c}'" : c }.join(' ') + end + if @varset[:echo] == :command + print_command.call elsif @varset[:echo] == :short puts short_desc end - system(*command) + system(*command).tap do |result| + unless result or @varset[:echo] == :command + $stdout.write "Failed command was: " + print_command.call + end + end end alias_method :orig_method_missing, :method_missing