Skip to content

Commit

Permalink
asciidoctor#78 Added support for cygwin
Browse files Browse the repository at this point in the history
  • Loading branch information
chanibal committed Sep 16, 2015
1 parent 7651ef5 commit 17f2328
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/asciidoctor-diagram/util/java_socket.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,16 @@ def initialize(java, classpath)
args = []
args << '-Djava.awt.headless=true'
args << '-cp'
args << classpath.flatten.join(File::PATH_SEPARATOR)
# special case for cygwin, it requires path translation for java to work
cygpath = ::Asciidoctor::Diagram.which('cygpath')
if(cygpath != nil)
args << classpath.flatten.map { |jar| `cygpath -w "#{jar}"`.strip }.join(";")
else
args << classpath.flatten.join(";")
end
args << 'org.asciidoctor.diagram.CommandServer'

puts "ARGS:"
puts args
@server = IO.popen([java, *args])
@port = @server.readline.strip.to_i
@client = TCPSocket.new 'localhost', port
Expand Down

0 comments on commit 17f2328

Please sign in to comment.