Move get-process-output-lines to util-io.
This commit is contained in:
parent
4ac7fdbc6d
commit
64cd360c0d
5 changed files with 29 additions and 19 deletions
|
@ -29,10 +29,13 @@
|
|||
util-io
|
||||
(
|
||||
read-lines/no-bom
|
||||
get-process-output-lines
|
||||
)
|
||||
|
||||
(import scheme
|
||||
(chicken io))
|
||||
(chicken base)
|
||||
(chicken io)
|
||||
(chicken process))
|
||||
|
||||
;; If given string begins with UTF-8 BOM, it is removed.
|
||||
(define (remove-optional-bom str)
|
||||
|
@ -52,4 +55,13 @@
|
|||
(cons (remove-optional-bom (car lines))
|
||||
(cdr lines)))))
|
||||
|
||||
;; Very simple shell command wrapper that returns lines produced by
|
||||
;; given command. Dangerous - performs no argument escaping!
|
||||
(define (get-process-output-lines cmd)
|
||||
(let-values (((stdout stdin pid stderr) (process* cmd)))
|
||||
(close-output-port stdin)
|
||||
(let ((result (read-lines stdout)))
|
||||
(let-values (((a b c) (process-wait pid)))
|
||||
result))))
|
||||
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue