(module test-mem mzscheme<br> (require (lib "process.ss"))<br> (define null-port (open-output-file "/dev/null" 'append))<br> (define null-iport (open-input-file "/dev/null"))<br> (define std-oport (current-output-port))
<br> <br> (define (x) (let-values ([(r w) (make-pipe)])<br> (process/ports w null-iport null-port "/sbin/sysctl -a")<br> (process/ports std-oport r null-port "grep vm.min_free_kbytes
")<br> ))<br> (define (y) (process/ports std-oport null-iport null-port "/sbin/sysctl -a| grep vm.min_free.kbytes"))<br> (define (z)<br> (let-values ([(r w) (make-pipe)])<br> (process/ports w null-iport null-port "/sbin/sysctl -a")
<br> (let loop ()<br> (let ([v (read-line r)])<br> (if (eof-object? r)<br> (void)<br> (begin<br> (fprintf std-oport "~a~n" v)<br> (loop))<br>
)))))<br> )<br><br>------------------------------------<br><br>Welcome to DrScheme, version 371.3-svn7nov2007 [3m].<br>Language: (module ...).<br>> (x)<br>(#f #f 11744 #f #<procedure:control>)<br>> (y)
<br>(#f #f 11745 #f #<procedure:control>)<br>vm.min_free_kbytes = 5858<br><br>1.why (x) and (y) is different?<br>2. why (z) could not terminate?<br><br clear="all">Thanks<br>-- <br>Gang