diff --git a/itamae.gemspec b/itamae.gemspec index fa8f93a6..52de6c18 100644 --- a/itamae.gemspec +++ b/itamae.gemspec @@ -18,7 +18,7 @@ Gem::Specification.new do |spec| spec.require_paths = ["lib"] spec.add_runtime_dependency "thor" - spec.add_runtime_dependency "specinfra", [">= 2.37.0", "< 3.0.0"] + spec.add_runtime_dependency "specinfra", [">= 2.43.11", "< 3.0.0"] spec.add_runtime_dependency "hashie" spec.add_runtime_dependency "ansi" spec.add_runtime_dependency "schash", "~> 0.1.0" diff --git a/lib/itamae/backend.rb b/lib/itamae/backend.rb index 85506887..7ccdb979 100644 --- a/lib/itamae/backend.rb +++ b/lib/itamae/backend.rb @@ -50,7 +50,7 @@ def run_command(commands, options = {}) Itamae.logger.with_indent do reset_output_handler - result = @backend.run_command(command) + result = @backend.run_command(command, options) flush_output_handler_buffer if result.exit_status == 0 || !options[:error] @@ -74,7 +74,7 @@ def run_command(commands, options = {}) end if options[:error] && result.exit_status != 0 - raise CommandExecutionError + fail CommandExecutionError, result.stderr end result @@ -248,6 +248,10 @@ def finalize Itamae.logger.info "Image created: #{image.id}" end + def run_command(commands, options = {}) + super(commands, options.merge({ tty: true })) + end + private def create_specinfra_backend begin diff --git a/lib/itamae/logger.rb b/lib/itamae/logger.rb index 498935c5..82423dca 100644 --- a/lib/itamae/logger.rb +++ b/lib/itamae/logger.rb @@ -48,7 +48,7 @@ def color(code, &block) %w!debug info warn error fatal unknown!.each do |level| module_eval(<<-EOC, __FILE__, __LINE__ + 1) def #{level}(msg) - super(" " * indent_depth + msg) + super(format("%s%s", " " * indent_depth, msg)) end EOC end