(define-public (ly:system command)
(let* ((status 0)
- (silenced
- (string-append command (if (ly:get-option 'verbose)
- ""
- " > /dev/null 2>&1 "))))
+ (dev-null "/dev/null")
+ (silenced (if (or (ly:get-option 'verbose)
+ (not (access? dev-null W_OK)))
+ command
+ (format #f "~a > ~a 2>&1 " command dev-null))))
(if (ly:get-option 'verbose)
(ly:message (_ "Invoking `~a'...") command))
"\""))
(define-public (postscript->pdf papersizename name)
- (let* ((cmd (format #f "ps2pdf -sPAPERSIZE=~a '~a'"
- (sanitize-command-option papersizename) name))
- (pdf-name (string-append (basename name ".ps") ".pdf" )))
+ (let* ((pdf-name (string-append (basename name ".ps") ".pdf" ))
+ (cmd (format #f
+ "gs\
+ -dSAFER\
+ -dCompatibilityLevel=1.4 \
+ -sPAPERSIZE=~a\
+ -q\
+ -dNOPAUSE\
+ -dBATCH\
+ -sDEVICE=pdfwrite\
+ -sOutputFile=~S\
+ -c .setpdfwrite\
+ -f ~S\
+"
+ (sanitize-command-option papersizename)
+ pdf-name
+ name)))
+ ;; The wrapper on windows cannot handle `=' signs,
+ ;; gs has a workaround with #.
+ (if (eq? PLATFORM 'windows)
+ (set! cmd (string-regex-substitute "=" "#" cmd)))
(if (access? pdf-name W_OK)
(delete-file pdf-name))
(format "~a/scripts/lilypond-ps2png.py" prefix)
"lilypond-ps2png"))
(cmd (format #f
- "~a --resolution=~S --papersize=~a~a '~a'"
+ "~a --resolution=~S --papersize=~a~a ~S"
(if (file-exists? ps2png-source)
(format "python ~a" ps2png-source)
"lilypond-ps2png")