Permalink
Browse files

Default to sending :out and :err on the message's transport, not the …

…transport that originated the session (fixes tpope/vim-foreplay#11)
  • Loading branch information...
cemerick committed Dec 11, 2012
1 parent 81580ae commit 46deb80c02dd78d9d01024418b27d30f0e3873cc
@@ -44,9 +44,9 @@
(.setLength buf 0)
text))]
(when (pos? (count text))
- (t/send transport
- (response-for *msg* :session session-id
- channel-type text))))))
+ (t/send (or (:transport *msg*) transport)
+ (response-for *msg* :session session-id
+ channel-type text))))))
true)))
(defn- session-in
@@ -90,6 +90,27 @@
combine-responses
(select-keys [:value :out])))))
+(def-repl-test sessionless-*out*
+ (is (= "5\n:foo\n"
+ (-> (repl-eval client "(println 5)(println :foo)")
+ combine-responses
+ :out))))
+
+(def-repl-test session-*out*
+ (is (= "5\n:foo\n"
+ (-> (repl-eval session "(println 5)(println :foo)")
+ combine-responses
+ :out))))
+
+(def-repl-test cross-transport-*out*
+ (let [sid (-> session meta ::nrepl/taking-until :session)
+ transport2 (nrepl/connect :port (:port *server*))]
+ (transport/send transport2 {"op" "eval" "code" "(println :foo)"
+ "session" sid})
+ (is (->> (repeatedly #(transport/recv transport2 100))
+ (take-while identity)
+ (some #(= ":foo\n" (:out %)))))))
+
(def-repl-test streaming-out
(is (= (for [x (range 10)]
(str x \newline))

0 comments on commit 46deb80

Please sign in to comment.