Moved legacy code into archive, ready for a new rapid(?) prototype.
I may regret doing this!
This commit is contained in:
parent
09051a3e63
commit
914c35ead0
114 changed files with 165 additions and 1 deletions
19
archive/unit-tests/allocation-tests/grep.bb
Executable file
19
archive/unit-tests/allocation-tests/grep.bb
Executable file
|
|
@ -0,0 +1,19 @@
|
|||
#!/home/simon/bin/bb
|
||||
|
||||
(require '[clojure.java.io :as io])
|
||||
(import '[java.lang ProcessBuilder$Redirect])
|
||||
|
||||
(defn grep [input pattern]
|
||||
(let [proc (-> (ProcessBuilder. ["grep" pattern])
|
||||
(.redirectOutput ProcessBuilder$Redirect/INHERIT)
|
||||
(.redirectError ProcessBuilder$Redirect/INHERIT)
|
||||
(.start))
|
||||
proc-input (.getOutputStream proc)]
|
||||
(with-open [w (io/writer proc-input)]
|
||||
(binding [*out* w]
|
||||
(print input)
|
||||
(flush)))
|
||||
(.waitFor proc)
|
||||
nil))
|
||||
|
||||
(grep "hello\nbye\n" "e")
|
||||
Loading…
Add table
Add a link
Reference in a new issue