Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (define-module (io run)
- #:use-module (io files)
- #:use-module (ice-9 popen)
- #:use-module (rnrs io ports)
- #:use-module (ice-9 receive)
- #:export (open-process
- run/str
- run/lines
- run/retval))
- (define open-process (@@ (ice-9 popen) open-process))
- (define (run/str command)
- (receive (in out _) (open-process OPEN_READ "sh" "-c" command)
- (let ([res (get-string-all in)])
- (close-port in)
- res)))
- (define (run/lines command)
- (receive (in out _) (open-process OPEN_READ "sh" "-c" command)
- (let ([res (port->list in get-line)])
- (close-port in)
- res)))
- (define run/retval system)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement