Thank you very much for your thoughts! I expected that the PDF output to stdout would be difficult to implement due to multiple Lilypond backends, and, probably, is not a real bottleneck in PDF generation. It is nice to know that intermediary files are already handled by a FS cache, and can be externally optimized by using a RAM disk.
Thank you, Vlad On Fri, Jan 5, 2024 at 4:46 AM David Wright <lily...@lionunicorn.co.uk> wrote: > On Thu 04 Jan 2024 at 23:34:28 (+0100), Volodymyr Prokopyuk wrote: > > > > I know that lilypond can receive a source.ly file from the stdin by > > using lilypond > > -. Is it possible for lilypond to output PDF to the stdout? > > > > My motivation behind using lilypond in a pipeline is to speed up PDF > > generation by avoiding storing intermediary files on disk. The pipeline > I'd > > like to implement is > > cat source.ly | lintLy | lilypond - | optimizePDF > score.pdf > > Currently lilypond engraves PDF on disk, so a PDF optimizer has to read, > > optimize, and substitute PDF on disk. > > You could create a RAM disk to hold your intermediate files, > something along the lines of: > > Ramdir="/dev/shm/${FUNCNAME[0]}$(printf '%(%s)T' -1)" > $ mkdir -p "$Ramdir" > > The first line (which I run in a bash function, for a quite different > purpose) creates a pseudounique but recognizable name, and the second > line creates the directory. > > Cheers, > David. >