glejeune / node-graphviz

Node.js interface to the GraphViz graphing tool
http://algorithmique.net
MIT License
197 stars 58 forks source link

Nissenbaum - long .dot strings are now supported #27

Closed daniel347x closed 6 years ago

daniel347x commented 6 years ago

Long .dot strings were causing multiple internal callbacks to the 'stdout' hander for the multiprocess communication, but the code assumed all output would occur in a single call to the 'stdout' handler. This caused a crash on long .dot strings because the final line in the first call to the stdout handler is typically cropped in the middle, causing a syntax error when that line is evaluated. The solution is to support multiple calls to the callback and append the data for all calls to a single variable, and only execute the command on the exit handler.

Additionally this commit adds some safety by waiting for the write handler to complete before calling the file-close function.