lib/screwcap/runner.rb in screwcap-0.7.3 vs lib/screwcap/runner.rb in screwcap-0.7.4
- old
+ new
@@ -24,16 +24,20 @@
task.__built_commands.each do |command|
ret = case command[:type]
when :remote
threads = []
- connections.each do |connection|
- threads << Thread.new(connection) do |conn|
- run_remote_command(command, conn, options)
+ if command[:parallel] == false
+ connections.each { |connection| run_remote_command(command, connection, options) }
+ else
+ connections.each do |connection|
+ threads << Thread.new(connection) do |conn|
+ run_remote_command(command, conn, options)
+ end
end
+ threads.each {|t| t.join }
end
- threads.each {|t| t.join }
when :local
ret = `#{command[:command]}`
command[:stdout] = ret
if $?.to_i == 0
if options[:verbose]
@@ -53,11 +57,11 @@
threads.each {|t| t.join }
when :block
command[:block].call
end
end
- _log "Complete\n", :color => :blue
+ _log "\nComplete\n", :color => :blue
task.__built_commands # for tests
end
private
@@ -70,9 +74,10 @@
if @@verbose
_log(" I: #{command[:command]}\n", :color => :green)
_log(" O: #{command[:stdout]}\n", :color => :green)
else
_log(".", :color => :green)
+ $stdout.flush
end
else
_errorlog(" E: (#{options[:address]}): #{command[:command]} return exit code: #{exit_code}\n", :color => :red) if exit_code != 0
end
exit_code