On Fri, Mar 4, 2011 at 1:41 PM, Stuart Sierra
<the.stuart.sie...@gmail.com> wrote:
> There are difficulties with using Clojure -- or any JVM language -- for
> system administration.  The first and biggest is the JVM startup time,
> making it impractical for command-line use without a separate "server"
> process.

Or you could just hoist the entire shell up into the JVM ...

Let's see ...

(def wd (atom (java.io.File. "/")))

(defn pwd [] @wd)

(defn file [thing]
  (if (instance? java.io.File thing) thing (File. (pwd) thing)))

(defn cwd [f]
  (let [f (file f)]
    (if (.isDirectory f)
      (reset! wd f)
      (throw (IllegalArgumentException. (str "No such directory: " f))))))

(defn ls [& opts]

...

:)

> Many common OS-level features -- launching processes and
> sending signals, for example -- are not available in the standard Java APIs,
> and require the use of native code or implementation-specific APIs.

Er, (.exec (Runtime/getRuntime) "foo") anyone? And that includes

(.exec (Runtime/getRuntime)
  (str "kill -s SIGALRM " get-some-pid))

of course. :)

> I'm not saying it can't be done, just that there may be better tools for the
> job.

After a little macro wizardry, that might actually turn out not to be
true. I certainly wouldn't categorically rule it out. :)

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to