Skip to content

Commit

Permalink
* Added tty: true to execute commands with docker.
Browse files Browse the repository at this point in the history
* Modified log format with docker results.
  • Loading branch information
tk-hamaguchi committed Oct 3, 2015
1 parent 5ce8c19 commit a320c23
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion itamae.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
8 changes: 6 additions & 2 deletions lib/itamae/backend.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/itamae/logger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a320c23

Please sign in to comment.