Class | BoxGrinder::SilencerProxy |
In: |
lib/boxgrinder-build/helpers/guestfs-helper.rb
lib/boxgrinder-build/helpers/guestfs-helper.rb |
Parent: | Object |
# File lib/boxgrinder-build/helpers/guestfs-helper.rb, line 27 27: def initialize(o, destination) 28: @o = o 29: @destination = destination 30: end
# File lib/boxgrinder-build/helpers/guestfs-helper.rb, line 27 27: def initialize(o, destination) 28: @o = o 29: @destination = destination 30: end
# File lib/boxgrinder-build/helpers/guestfs-helper.rb, line 32 32: def method_missing(m, *args, &block) 33: begin 34: redirect_streams(@destination) do 35: @o.send(m, *args, &block) 36: end 37: rescue 38: raise 39: end 40: end
# File lib/boxgrinder-build/helpers/guestfs-helper.rb, line 32 32: def method_missing(m, *args, &block) 33: begin 34: redirect_streams(@destination) do 35: @o.send(m, *args, &block) 36: end 37: rescue 38: raise 39: end 40: end
# File lib/boxgrinder-build/helpers/guestfs-helper.rb, line 42 42: def redirect_streams(destination) 43: old_stdout_stream = STDOUT.dup 44: old_stderr_stream = STDERR.dup 45: 46: STDOUT.reopen(destination) 47: STDERR.reopen(destination) 48: 49: STDOUT.sync = true 50: STDERR.sync = true 51: 52: yield 53: ensure 54: STDOUT.reopen(old_stdout_stream) 55: STDERR.reopen(old_stderr_stream) 56: end
# File lib/boxgrinder-build/helpers/guestfs-helper.rb, line 42 42: def redirect_streams(destination) 43: old_stdout_stream = STDOUT.dup 44: old_stderr_stream = STDERR.dup 45: 46: STDOUT.reopen(destination) 47: STDERR.reopen(destination) 48: 49: STDOUT.sync = true 50: STDERR.sync = true 51: 52: yield 53: ensure 54: STDOUT.reopen(old_stdout_stream) 55: STDERR.reopen(old_stderr_stream) 56: end