Janet Notes and Examples

Managing Processes

(os/shell "which pandoc")
(os/execute ["which" "pandoc"] :p)

To save the output from a command you shell out to:

(def x (os/spawn ["date"] :p {:out :pipe}))
(def s (:read (x :out) :all))                 # the date string
(:wait x)                                     # have `x` finish

# And maybe put all that into a function:
(defn shell-out
  [cmd]
  (let [x (os/spawn [cmd] :p {:out :pipe})
        s (:read (x :out) :all)]
    (:wait x)
    s))