Sha256: e4e375223c24768102841673b4451baf3611bf37ead2ded709c22511d20c6760
Contents?: true
Size: 701 Bytes
Versions: 15
Compression:
Stored size: 701 Bytes
Contents
module WatchmonkeyCli class LoopbackConnection def initialize(id, opts = {}, &initializer) @id = id @opts = {}.merge(opts) # @mutex = Monitor.new initializer.try(:call, @opts) end def to_s "#<WatchmonkeyCli::LoopbackConnection:#{@id}>" end def name "lo:#{@id}" end def sync &block # @mutex.synchronize(&block) block.try(:call) end def exec cmd, chomp = true _stdin, _stdouterr, _thread = Open3.popen2e(cmd) _thread.join res = _stdouterr.read chomp ? res.chomp : res ensure _stdin.close rescue false _stdouterr.close rescue false end def close! end end end
Version data entries
15 entries across 15 versions & 1 rubygems