diff --git a/lib/systemu.rb b/lib/systemu.rb index 04c24d9..e6cbb8e 100644 --- a/lib/systemu.rb +++ b/lib/systemu.rb @@ -121,9 +121,9 @@ 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 @@ -205,9 +205,9 @@ def child_program config 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} @@ -256,11 +256,11 @@ def tmpdir d = Dir.tmpdir, max = 42, &b 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