Skip to content

Instantly share code, notes, and snippets.

@arohner
Created October 25, 2013 04:57
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 arohner/7149600 to your computer and use it in GitHub Desktop.
Save arohner/7149600 to your computer and use it in GitHub Desktop.
into-array>
(t/ann make-process [String -> java.lang.Process])
(defn make-process [script]
(let [^Runtime r (Runtime/getRuntime)
arr (t/into-array> String ["echo 'hello'"])]
(t/print-env "let")
(.exec r arr)))
@arohner
Copy link
Author

arohner commented Oct 25, 2013

ExceptionInfo Internal Error (circle.scratch:14:5) Unresolved instance method invocation exec.

Hint: add type hints.

in: (.exec r arr) clojure.core/ex-info (core.clj:4327)

@frenchy64
Copy link

The problem was reflection:

(cf (fn make-process [script]
      {:post [%]}
      (let [^Runtime r (Runtime/getRuntime)
            _ (assert r)
            ^"[Ljava.lang.String;" arr (into-array> String ["echo 'hello'"])]
        (.exec r arr)))
    [String -> java.lang.Process])

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