This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-01-25
Channels
- # arachne (1)
- # beginners (22)
- # boot (21)
- # cider (23)
- # cljs-dev (16)
- # cljsrn (9)
- # clojure (118)
- # clojure-dev (11)
- # clojure-greece (16)
- # clojure-italy (10)
- # clojure-losangeles (4)
- # clojure-russia (14)
- # clojure-serbia (4)
- # clojure-spec (58)
- # clojure-uk (33)
- # clojurescript (30)
- # cursive (17)
- # datomic (48)
- # docs (22)
- # events (1)
- # fulcro (24)
- # hoplon (3)
- # jobs (6)
- # jobs-discuss (4)
- # keechma (4)
- # leiningen (11)
- # luminus (4)
- # midje (1)
- # off-topic (107)
- # onyx (30)
- # other-languages (12)
- # pedestal (4)
- # re-frame (72)
- # reagent (6)
- # remote-jobs (1)
- # shadow-cljs (16)
- # spacemacs (3)
- # specter (9)
- # uncomplicate (4)
- # unrepl (40)
How can I make a little snippet for SPIRAL that does a require/load rather than eval current buffer? (eval current buffer loses line info)
hey @volrath. I'm really enjoying SPIRAL. Is spiral-eval-buffer calling (require 'foo) or (load "foo") or is it feeding the contents of the buffer to the REPL?
I see. Yeah if I call it, and then the code later throws an exception, the line/file info is missing/wrong
sorry, words: if I eval-buffer, then my code throws an exception, line/file info is lost
Unhandled Exception
java.lang.ArithmeticException: Divide by zero
clojure.lang.Compiler$CompilerException: java.lang.ArithmeticException: Divide by zero, compiling:(connect.clj:3:1)
Numbers.java: 163 - clojure.lang.Numbers/divide
Numbers.java: 3833 - clojure.lang.Numbers/divide
/home/volrath/projects/tests/spiral-tests/src/spiral_tests/connect.clj: 3 - spiral.connect$eval1304/invokeStatic
/home/volrath/projects/tests/spiral-tests/src/spiral_tests/connect.clj: 3 - spiral.connect$eval1304/invoke
Compiler.java: 7062 - clojure.lang.Compiler/eval
Compiler.java: 7514 - clojure.lang.Compiler/load
load_file.clj: 9 - spiral.tools.load_file$load_file_code/invokeStatic
load_file.clj: 4 - spiral.tools.load_file$load_file_code/invoke
unrepl-session: 7 - user$eval1292/invokeStatic
unrepl-session: 7 - user$eval1292/invoke
...
alright cool, let me know either way if you find the solution to your problem... you could also try to load the file in a regular repl, just to discard unrepl/spiral completely
I had a socket server exposed to the internet:
(defn check-auth
[secret]
(when-not (= secret (edn/read))
(println "go away")
(throw (Exception. "Unauthenticated"))))
(defn repl
[]
(check-auth :MAGICVALUE)
(clojure.main/repl
:init #(in-ns 'user)
:read clojure.core.server/repl-read))
could do that, but I have it in a remote docker container, was trying to avoid a sidecar process
but if you really really want to you could use a special accept fn and add your secret at the start of the blob (BYOB ftw)
(require '[net.cgrand.xforms :as x]
'[clojure.string :as str]
'[jsonista.core :as j]
'[clojure.pprint :refer [pprint] :rename {pprint p*}]
'[ :as io] :reload-all)
~ Unhandled Exception
java.lang.IllegalArgumentException: argument type mismatch
clojure.lang.Compiler$CompilerException: java.lang.IllegalArgumentException: argument type mismatch, compiling:(jsonista/core.clj:1:1)
NativeMethodAccessorImpl.java: -2 - sun.reflect.NativeMethodAccessorImpl/invoke0
NativeMethodAccessorImpl.java: 62 - sun.reflect.NativeMethodAccessorImpl/invoke
DelegatingMethodAccessorImpl.java: 43 - sun.reflect.DelegatingMethodAccessorImpl/invoke
Method.java: 497 - java.lang.reflect.Method/invoke
NO_SOURCE_FILE: 397 - unrepl.replG__1676$classloader$fn__1932/invoke
nil: -1 - unrepl.replG__1676.proxy$java.lang.ClassLoader$ff19274a/findClass
ClassLoader.java: 424 - java.lang.ClassLoader/loadClass
nil: -1 - unrepl.replG__1676.proxy$java.lang.ClassLoader$ff19274a/loadClass
ClassLoader.java: 411 - java.lang.ClassLoader/loadClass
DynamicClassLoader.java: 77 - clojure.lang.DynamicClassLoader/loadClass
New project https://github.com/Unrepl/ssh-repl
Right now it’s a placeholder but of someone wants to step in, I can provide a master plan
it used to be really quick (a minute or so) but a few weeks ago I noticed it would take a couple of hours to update. I don't know if it was a circumstantial anomaly or that's the way it is now
you can check out here: https://melpa.org/#/spiral when version changes to 20180125.XXXX, the latest changes are up