asciidoctor-diagram: Use stdin/out instead of TCP socket is broken on Windows
TLDR; https://github.com/asciidoctor/asciidoctor-diagram/issues/254#issuecomment-571632957
After I have updated gem to v 2.0.0 asciidoctor-diagram doesn’t work for me.
Win10, ruby 2.6, ruby 2.7 with current asciidoctor and asciidoctor-pdf.
More details: https://github.com/asciidoctor/asciidoctor-pdf/issues/1473
Test File
= Issue 1473: Plantuml? asciidoctor-diagram?
:imagesdir: images
== Introduction
[plantuml, hello_world, svg, width=70%]
....
skinparam monochrome true
skinparam shadowing true
skinparam dpi 300
skinparam backgroundcolor transparent
skinparam classarrowFontSize 8
!define table(x) class x << (T,#ede7aa) >>
!define view(x) class x << (V,lightblue) >>
!define f(n,t) {field}n <color:gray>: t</color>
!define string(n,size) {field}n <color:gray>: varchar(size)</color>
hide methods
hide stereotypes
table(DQI_ENGINE.DQI_SCHEDULE) {
f(**sch_id**, **number**)
..
string(dqi_plan_name, 500)
string(sch_type, 20)
f(priority, number)
string(day_of_month, 100)
string(day_of_week, 100)
string(hour, 100)
string(reference_date, 10)
f(is_enabled, boolean)
}
....
command
asciidoctor-pdf -r asciidoctor-diagram issue-1473.adoc
output
NONE, it “works” and never stops.
With previous version 1.5.19 it works just fine.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 34 (20 by maintainers)
Commits related to this issue
- #254 Use binary mode when communicating with Java subprocess — committed to asciidoctor/asciidoctor-diagram by pepijnve 4 years ago
- #254 Update changelog — committed to asciidoctor/asciidoctor-diagram by pepijnve 4 years ago
have tested new gem – looks good!
@habamax could you check if commit eee4c50 fixes the problem for you?
One missing character 🤦♂
@habamax since you were asking how this stuff worked:
PlantUML is written in Java. Launching a new instance of PlantUML for every individual diagram is prohibitively slow when dealing with large documents with many diagrams. The JVM just takes too long to start up. To speed this up we need a way to launch the JVM once and reuse it.
One solution for that would be to launch the PlantUML server, but that would only work for PlantUML, not for other Java-based tools like Ditaa. So instead of doing that I created my own mini server (see https://github.com/asciidoctor/asciidoctor-diagram-java). It’s essentially a naive little HTTP server that can render PlantUML and Ditaa diagrams.
The older versions of this server bound a TCP socket, printed the listening port on stdout and then waited for incoming requests on that port. Asciidoctor-diagram read the TCP port from stdout and then connected to the service on the loopback interface. At one point I realised that’s needlessly complicated. The service is spawned as a subprocess so we can simply communicate with it over stdin/stdout instead. Unfortunately I forgot that on Windows
IO
does EOL <-> CRLF conversion by default. Since we’re talking HTTP over stdin/out and expect binary data (PNGs) as response that definitely needs to be turned off.Appveyour builds fail during pre-requisites intallations last on during
npm install -g wavedrom-cli
and previous onescinst graphviz.portable
. So the build is not even getting to the error.According to documentation Github actions is Windows Server 2016 o 2019, same as Appveyour. We can try and see.