[xcvb-devel] run-program/process-output-stream

Peter Keller psilord at cs.wisc.edu
Thu Apr 14 15:14:08 UTC 2011


On Thu, Apr 14, 2011 at 10:30:53AM -0400, Faré wrote:
> On 14 April 2011 01:59, Peter Keller <psilord at cs.wisc.edu> wrote:
> > (run-program/process-output-stream '("echo" "string") 'slurp-stream-lines)
> >
> > I get back this list:
> > ("string") ;; notice no newline.
> >
> > Now suppose I call it like this:
> >
> > (run-program/process-output-stream '("echo" "string") 'slurp-stream-string)
> >
> > I would then get back:
> >
> > "string
> > "
> >       ^ Notice the newline
> >
> > Is this the expected behavior for this function wrt these output-processors?
> >
> Yes. In one case, you get the entire output in a single string that
> you may process as you wish, in the other you use read-line, which
> strips newlines for you.

Ah, I was just curious, because in perl, this code:

@foo = `cat file`;

(which is similar in concept to run-program/process-output-lines with the
'slurp-stream-lines output processor) preserves the newline for each line.

I'm not advocating change, but I was surprised by the newline difference
between the two stream processors.

Also, would you prefer that I added docstrings for how to use these
functions? Or just commented above them their use/edge cases and whatnot?

BTW, I got hu.dwim.stefil working (and the required externals installed in
the same manner as the others) and have started writing a basic unit-test
suite for run-program/*. I need to figure out how to test for signaled
conditions and other things too, but I'm making progress.

Later,
-pete




More information about the xcvb-devel mailing list