From 0dc976913ccc502cd6bf69f0431215994efab351 Mon Sep 17 00:00:00 2001 From: Mariano Guerra Date: Mon, 11 Feb 2013 11:07:44 +0100 Subject: [PATCH] add version of call-timeout that doesn't convert args call-timeout-raw, it's your job to convert them --- src/clj/clj_rhino.clj | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/clj/clj_rhino.clj b/src/clj/clj_rhino.clj index ef07f35..e23e076 100644 --- a/src/clj/clj_rhino.clj +++ b/src/clj/clj_rhino.clj @@ -146,6 +146,14 @@ (.evaluateString ctx scope code filename line-number sec-domain) (finally (Context/exit))))) +(defn call-timeout-raw [scope fun timeout-ms & args] + (let [factory (TimedContextFactory. timeout-ms) + ctx (.enterContext factory) + args (into-array Object args)] + (try + (.call fun ctx scope nil args) + (finally (Context/exit))))) + (defn call-timeout [scope fun timeout-ms & args] (let [factory (TimedContextFactory. timeout-ms) ctx (.enterContext factory)