chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-users] large amount of data will break open-pipe


From: Lui Fungsin
Subject: [Chicken-users] large amount of data will break open-pipe
Date: Tue, 15 Apr 2008 14:16:11 -0700

Is this a known limitation (similar to max string size of 0x00ffffff)?

I use pipe to connect through multiple processes (like grep / sort
/uniq,etc) and it is very handy.

I'm hoping that this is a bug and not a limitation...

Try the following code, enter 1500 is OK but if you enter 2000, the
program will abort with a broken pipe.

Thanks,
fungsin


(declare (uses extras regex posix utils))
(require-extension loop)
(require-extension miscmacros)

(define-macro (with-output-to-less . body)
  `(with-output-to-pipe "/usr/bin/less -X -E -M" (lambda () ,@body)))

(define (command-loop)
  (loop for line = (begin (display "Enter a number or `exit' to quit>
") (read-line))
        while (and line (not (eof-object? line)))
        if (equal? line "exit") do
        (exit)
        else do
        (let ((n (ignore-errors (string->number line))))
          (when n
              (with-output-to-less
               (repeat n (print "Chicken Chicken Chicken Chicken
Chicken Chicken")))))))

(command-loop)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]