Skip to content

Instantly share code, notes, and snippets.

@arohner
Created October 25, 2013 04:57
Show Gist options
  • Select an option

  • Save arohner/7149600 to your computer and use it in GitHub Desktop.

Select an option

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

arohner commented Oct 25, 2013

Copy link
Copy Markdown
Author

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
Copy Markdown

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