lib/systemu.rb in systemu-2.6.3 vs lib/systemu.rb in systemu-2.6.4

- old
+ new

@@ -12,11 +12,11 @@ class SystemUniversal # # constants # - SystemUniversal::VERSION = '2.6.3' unless SystemUniversal.send(:const_defined?, :VERSION) + SystemUniversal::VERSION = '2.6.4' unless SystemUniversal.send(:const_defined?, :VERSION) def SystemUniversal.version() SystemUniversal::VERSION end def version() SystemUniversal::VERSION end def SystemUniversal.description "universal capture of stdout and stderr and handling of child process pid for windows, *nix, etc." end @@ -122,13 +122,13 @@ def quote *args, &block SystemUniversal.quote(*args, &block) end - def new_thread cid, block + def new_thread child_pid, block q = Queue.new - Thread.new(cid) do |cid| + Thread.new(child_pid) do |cid| current = Thread.current current.abort_on_exception = true q.push current block.call cid end @@ -206,13 +206,13 @@ end program end def relay srcdst - src, dst, ignored = srcdst.to_a.first + src, dst, _ = srcdst.to_a.first if src.respond_to? 'read' - while((buf = src.read(8192))); dst << buf; end + while((buffer = src.read(8192))); dst << buffer; end else if src.respond_to?(:each_line) src.each_line{|buf| dst << buf} else src.each{|buf| dst << buf} @@ -257,14 +257,14 @@ } end def getopts opts = {} lambda do |*args| - keys, default, ignored = args + keys, default, _ = args catch(:opt) do [keys].flatten.each do |key| - [key, key.to_s, key.to_s.intern].each do |key| - throw :opt, opts[key] if opts.has_key?(key) + [key, key.to_s, key.to_s.intern].each do |k| + throw :opt, opts[k] if opts.has_key?(k) end end default end end