Welcome! Please see the About page for a little more info on how this works.

+1 vote
in IO by

Clojure-1.12 added a clojure.java.process namespace. I'm confused about why clojure.java.process/capture is exposed as a public API, since it does basically the same thing as slurp except for minor differences in options.

by
Not an answer but an interesting difference is that `capture` trims its output, for some reason, whereas `slurp` does not. Feels like it can potentially lead to problems with dealing with processes that genuinely need to output leading/ending whitespace.
by
it is surprising to see this added, and not something similar that is suitable for binary data which is missing

1 Answer

+1 vote
by
selected by
 
Best answer

It is a good question, and capture started life doing more things, which have slowly stripped away such that it's now mostly the same as slurp. Trimming output is something I have constantly found myself doing in parsing the output of shell calls, but maybe having it in capture (which could really be slurp) is not right. I think there is still one more round of adjustments we're going to need to make in this area.

...