Sha256: 893aa869c4af1facc5142078a16cb86884c550604510cceb0270890f323017a1
Contents?: true
Size: 814 Bytes
Versions: 2
Compression:
Stored size: 814 Bytes
Contents
module WatchmonkeyCli class LoopbackConnection attr_reader :opts, :established def initialize(id, opts = {}, &initializer) @id = id @established = false @opts = {}.merge(opts) # @mutex = Monitor.new initializer.try(:call, @opts) end def to_s "#<WatchmonkeyCli::LoopbackConnection:#{@id}>" end def name "lo:#{@id}" end def established? @established 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
watchmonkey_cli-1.12.0 | lib/watchmonkey_cli/loopback_connection.rb |
watchmonkey_cli-1.11.0 | lib/watchmonkey_cli/loopback_connection.rb |