Skip to content

Instantly share code, notes, and snippets.

@codification
Created March 6, 2012 08:10
Show Gist options
  • Save codification/1984857 to your computer and use it in GitHub Desktop.
Save codification/1984857 to your computer and use it in GitHub Desktop.
Clojure asynchronous process
(ns proc
(:import [java.lang ProcessBuilder])
(:use [clojure.java.io :only [reader writer]]))
(defn spawn [& args]
(let [process (-> (ProcessBuilder. args)
(.start))]
{:out (-> process
(.getInputStream)
(reader))
:err (-> process
(.getErrorStream)
(reader))
:in (-> process
(.getOutputStream)
(writer))
:process process}))
@optevo
Copy link

optevo commented Jan 5, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment