Skip to content

Instantly share code, notes, and snippets.

@darwin
Last active December 10, 2015 21:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save darwin/0375c435ed239db7ce4a to your computer and use it in GitHub Desktop.
Save darwin/0375c435ed239db7ce4a to your computer and use it in GitHub Desktop.
(def ^:dynamic *orig-out* nil)
; see http://docs.oracle.com/javase/7/docs/api/java/io/Writer.html
(def out-proxy
(proxy [StringWriter] []
(write
([x]
(.write *orig-out* x)
(proxy-super write x))
([x off len]
(.write *orig-out* x off len)
(proxy-super write x off len)))
(append
([x]
(.append *orig-out* x)
(proxy-super append x)
this)
([x start end]
(.append *orig-out* x start end)
(proxy-super append x start end)
this))
(close
([]
(.close *orig-out*)
(proxy-super close)))
(flush
([]
(.flush *orig-out*)
(proxy-super flush)))
))
....
(binding [repl-driver/*orig-out* *out*
*out* repl-driver/out-proxy]
(start-cljs-repl protocol figwheel-repl-env repl-opts)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment