Skip to content

Instantly share code, notes, and snippets.

@tizoc
Created May 8, 2012 17:09
Show Gist options
  • Save tizoc/2637422 to your computer and use it in GitHub Desktop.
Save tizoc/2637422 to your computer and use it in GitHub Desktop.
(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