dmac / fezzik

A light deployment system that takes care of the heavy lifting.
https://rubygems.org/gems/fezzik
MIT License
37 stars 6 forks source link

Fezzik::Util.capture_output is not thread-safe #41

Closed dmac closed 11 years ago

dmac commented 11 years ago

Fezzik::Util.capture_output overrides $stdout without synchronizing it between threads. This creates a race condition when multiple threads attempt to print.

include Fezzik::DSL

destination :prod do
  set :domain, ["a.com", "b.com"]
end

remote_task :echo do
  output = capture_output { run "echo 'hi'" }
  puts output.inspect
end
$ fez prod echo
Loading Fezzik tasks from config/tasks
Targeting hosts:
    a.com
    b.com
""
"hi\nhi\n"
[success]