Use scsh-process Chicken egg
As advised by Vasilij on IRC. This is thread-safe, whereas (chicken process) gives mysterious failures in every batch of documents I tried. TODO: Rethink `pandoc-command-line`.
This commit is contained in:
parent
181522ca83
commit
65a78f8659
|
@ -11,10 +11,10 @@
|
|||
(only (chicken io) read-byte write-byte)
|
||||
(only (chicken port) copy-port)
|
||||
(only (chicken process) process process-wait)
|
||||
(rename (only (medea) read-json)
|
||||
(read-json json-read)))
|
||||
(only (scsh-process) run/port)
|
||||
(only (medea) read-json))
|
||||
|
||||
(define (run-read-write args input-port read-output)
|
||||
(define (run-read-write/old args input-port read-output)
|
||||
(receive (from-sub to-sub sub) (process (car args) (cdr args))
|
||||
(copy-port input-port to-sub read-byte write-byte)
|
||||
(close-output-port to-sub)
|
||||
|
@ -28,6 +28,11 @@
|
|||
(if (and clean-exit? (eqv? 0 exit-status)) output
|
||||
(error "Error running" args))))))
|
||||
|
||||
(define (pandoc-port->json input-format input-port)
|
||||
(let ((pandoc (string->symbol (car (pandoc-command-line)))))
|
||||
(read-json (run/port (,pandoc --from ,input-format --to json)
|
||||
(= 0 input-port)))))
|
||||
|
||||
(define (call-with-binary-input-file filename proc)
|
||||
(let ((port (open-input-file filename #:binary)))
|
||||
(dynamic-wind (lambda () #f)
|
||||
|
|
|
@ -100,13 +100,6 @@
|
|||
(assert-supported-version)
|
||||
(convert-many (vector->list (cdr (assq 'blocks json)))))
|
||||
|
||||
(define (pandoc-port->json input-format input-port)
|
||||
(run-read-write (append (pandoc-command-line)
|
||||
(list "--from" (symbol->string input-format)
|
||||
"--to" "json"))
|
||||
input-port
|
||||
json-read))
|
||||
|
||||
(define (pandoc-port->sxml input-format input-port)
|
||||
(pandoc-json->sxml (pandoc-port->json input-format input-port)))
|
||||
|
||||
|
|
Loading…
Reference in New Issue