I need to descend a directory structure with ~5000 files in it and run an external process on each to gether information on each file. However, after running over about 250 files, I get a "Too many open files" error. 250 is probably OSX default max open file limit - but I don't understand why the 'with-input-from-process' doesn't appear to be closing its file handle? I also tried with 'open-input-process' and 'open-process' and manually calling 'close-input-port' but didn't help. Here's a small script that shows the exact same prob:
And the output:(define (test-fn)(define (do-process)(with-input-from-process (list path: "pwd") read-all))(let loop [(count 2000)](if (> count 0)(begin(do-process)(loop (- count 1)))(println "Done"))))
(test-fn)