Created
March 31, 2012 18:29
-
-
Save gsimard/2267395 to your computer and use it in GitHub Desktop.
Sandbox multithread problem ?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Sandbox | |
(def ^:dynamic *sb* nil) | |
(defn make-sb [] | |
(def ^:dynamic *sb* (sandbox (conj secure-tester-without-def :timeout 2000)) | |
;; Define some functions within the sandbox | |
(*sb* '(defn jump [] (str "JUMP")))) | |
;; Swank | |
(def ^:dynamic *swank* nil) | |
(defn -startSwank [] | |
(if (not *swank*) ;; we can't set *swank* to future, otherwise this test would block, so use a vector | |
(def ^:dynamic *swank* [true (future (swank.swank/start-server :host "localhost" :port 4005))])) | |
true) | |
;; Then, from emacs, I connect to swank and issue: | |
(*sb* '*ns*) | |
#<Namespace sandbox29> | |
(*sb* 'jump) | |
#<sandbox29$jump sandbox29$jump@8c666a> | |
(*sb* '(defn asdf [] (+ 1 2))) | |
#'sandbox29/asdf | |
(*sb* 'jump) | |
Unable to resolve symbol: jump in this context, compiling:(NO_SOURCE_PATH:0) [Thrown class java.util.concurrent.ExecutionException] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment