Sha256: 76e3b71d51bcdc3f546d63ccb70917963cc704e671690ef3391d54e0c9c09893
Contents?: true
Size: 956 Bytes
Versions: 8
Compression:
Stored size: 956 Bytes
Contents
module JstdRunner class VncControl class Error < StandardError end class << self def displays Dir[File.expand_path("~/.vnc/*.pid")].map { |e| e[/(\d+)\.pid/, 1] }.compact end def all displays.map { |display| new(":#{display}") } end end attr_reader :display def initialize(display = nil) @display = display end def start if @display server @display Log.info "vnc server launched on #{@display.inspect}" else output = server @display = output[/desktop is #{host}(\S+)/, 1] end end def stop server "-kill", @display.to_s end private def server(*args) out = `tightvncserver #{args.join ' '} 2>&1` unless $?.success? raise Error, "could not run tightvncserver: #{out.inspect}" end out end def host @host ||= Socket.gethostname end end end
Version data entries
8 entries across 8 versions & 1 rubygems