Permalink
Browse files

suggestion of per-cmd err streams to complement Takahiro's idea of re…

…turning all cmds' result maps
  • Loading branch information...
1 parent 2113f67 commit d081a1c7533fa5f6724b4a7c8cb31eec3f26b106 @echeran echeran committed Apr 24, 2012
Showing with 5 additions and 4 deletions.
  1. +5 −4 src/clj_commons_exec.clj
@@ -163,8 +163,9 @@
middle-stream-sets (reduce concat
(for [_ (range (dec num-cmds))]
(let [pos (java.io.PipedOutputStream.)
- pis (java.io.PipedInputStream. pos)]
- [[pos nil nil] [nil nil pis]])))
+ pis (java.io.PipedInputStream. pos)
+ err (java.io.ByteArrayOutputStream.)]
+ [[pos err nil] [nil nil pis]])))
last-stream-set [out err nil]
all-stream-sets (concat [first-stream-set] middle-stream-sets [last-stream-set])
all-streams (map (fn [[set1 set2]] (map (fn [stream1 stream2] (or stream1 stream2)) set1 set2)) (partition 2 all-stream-sets))
@@ -175,5 +176,5 @@
(assoc :in cmd-in))
sh-fn-args (concat cmd-and-args [new-opts])]
(apply sh sh-fn-args)))]
- (last (doall
- (map exec-fn cmds-list all-streams)))))
+ (doall
+ (map exec-fn cmds-list all-streams))))

0 comments on commit d081a1c

Please sign in to comment.