blob: 95362607a6dc116db3ce1fbd768fba3fb2787ff1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
(define-module (hnh test xmllint)
:use-module (srfi srfi-1)
:use-module (srfi srfi-71)
:use-module (srfi srfi-88)
:use-module ((rnrs io ports) :select (get-string-all))
:use-module ((hnh util) :select (begin1))
:export (xmllint)
)
(define (xmllint str)
(let ((in* out (car+cdr (pipe)))
(in out* (car+cdr (pipe)))
(cmdline (string-split "xmllint --format -" #\space)))
(define pid
(spawn (car cmdline) cmdline
input: in*
output: out*))
(close-port in*)
(close-port out*)
(display str out)
(force-output out)
(close-port out)
(begin1 (get-string-all in)
(close-port in))))
|