class Asciidoctor::Diagram::Java::CommandServer
Attributes
port[R]
Public Class Methods
new(java, classpath)
click to toggle source
# File lib/asciidoctor-diagram/util/java_socket.rb, line 14 def initialize(java, classpath) args = [] args << '-Djava.awt.headless=true' args << '-Djava.net.useSystemProxies=true' args << '-cp' args << classpath.flatten.map { |jar| ::Asciidoctor::Diagram::Platform.host_os_path(jar).strip }.join(::Asciidoctor::Diagram::Platform.host_os_path_separator) args << 'org.asciidoctor.diagram.CommandServer' @server = IO.popen([java, *args]) @port = @server.readline.strip.to_i @client = TCPSocket.new 'localhost', port end
Public Instance Methods
io()
click to toggle source
# File lib/asciidoctor-diagram/util/java_socket.rb, line 27 def io @client end
shutdown()
click to toggle source
# File lib/asciidoctor-diagram/util/java_socket.rb, line 31 def shutdown # KILL is a bit heavy handed, but TERM does not seem to shut down the JVM on Windows. Process.kill('KILL', @server.pid) end