Created
May 8, 2012 17:09
-
-
Save tizoc/2637422 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(import (chibi io) (chibi process)) | |
(define (for-each-line proc port) | |
(let loop ((line (read-line port))) | |
(cond ((not (eof-object? line)) | |
(proc line) | |
(loop (read-line port)))))) | |
(call-with-process-io '("ls" "/tmp") | |
(lambda (pid in out err) | |
(for-each-line write-line out))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment