This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-12-07
Channels
- # adventofcode (62)
- # babashka (88)
- # beginners (52)
- # boot (2)
- # bristol-clojurians (1)
- # calva (7)
- # cider (15)
- # circleci (4)
- # clj-kondo (12)
- # cljdoc (5)
- # cljsrn (4)
- # clojure (53)
- # clojure-dev (1)
- # clojure-spec (7)
- # clojure-uk (7)
- # clojurescript (25)
- # core-async (14)
- # duct (1)
- # emacs (10)
- # figwheel-main (3)
- # fulcro (11)
- # garden (14)
- # jobs (1)
- # klipse (2)
- # luminus (1)
- # malli (9)
- # re-frame (6)
- # reagent (13)
- # remote-jobs (1)
- # shadow-cljs (124)
- # sql (1)
- # testing (15)
- # tools-deps (13)
- # uncomplicate (1)
- # vim (1)
Sci var feature is merged to master: https://borkdude.github.io/sci/#vars
nice looking docs 🙂 apart from the ususal commenting out of part of the socket-repl tests and changing the python exe name, all tests pass here.
sci v0.0.11 released: https://github.com/borkdude/sci/releases/tag/v0.0.11
@sogaiu Given that the babashka tests still pass on CI linux: <https://circleci.com/gh/borkdude/babashka/2127> I'm not sure what's the problem here: <https://github.com/borkdude/babashka/issues/140>
@borkdude Will it be possible to get helpful stack trace that refer to my code and not just sci? When running https://github.com/holyjak/blog.jakubholy.net/blob/cryogen/content/tmp-migration/old/md/fix-files.clj I am getting
ERROR !!! for file #object[.File 0x104963f4 ./pages/2--about/nocv.md.asc] : #error {
:cause renameTo failed
:via
[{:type clojure.lang.ExceptionInfo
:message renameTo failed [at line 80, column 21]
:data {:type :sci/error, :row 80, :col 21, :message renameTo failed [at line 80, column 21]}
:at [sci.impl.utils$rethrow_with_location_of_node invokeStatic utils.cljc 66]}
{:type java.lang.Exception
:message renameTo failed
:at [java.lang.reflect.Constructor newInstance Constructor.java 423]}]
:trace
[[java.lang.reflect.Constructor newInstance Constructor.java 423]
[clojure.lang.Reflector invokeConstructor Reflector.java 305]
[sci.impl.interop$invoke_constructor invokeStatic interop.cljc 29]
[sci.impl.interpreter$eval_constructor_invocation invokeStatic interpreter.cljc 262]
[sci.impl.interpreter$eval_call invokeStatic interpreter.cljc 318]
...
which is really not helpful. Otherwise bb is awesome!@holyjak Can you post an issue with what you expect other than it is now? [at line 80, column 21] points to the location in your script
Ah, sorry, my bad! I assumed the line/column refers to SCI code since only that is mentioned in the stack trace.
I expected at fix-files.clj
at the top of the stacktrace (and possible the function call chain within that file).
@sogaiu ah you scared me there, so it isn't really a regression in babashka itself 😉
Feel free to propose any improvements to the tests so they also pass on other linuxes than CircleCI linux and PR those. I just did what worked for the given environments I had
fwiw, i did mention it before -- is it ok to drop -q? then you don't even need to check for mac?
@sogaiu
the -q
option on circleci:
-q secs quit after EOF on stdin and delay of secs
https://unix.stackexchange.com/questions/189454/netcat-doesnt-terminate-when-stdin-closes
FAIL in (socket-repl-test) (socket_repl_test.clj:41)
ctrl-d exits normally, doesn't print nil
expected: (str/ends-with? (:out (sh "bash" "-c" (if mac? "echo \"(inc 1336)\" | nc 127.0.0.1 1666" "echo \"(inc 1336)\" | nc -w0 127.0.0.1 1666"))) "1337\nuser=> ")
actual: (not (str/ends-with? "" "1337\nuser=> "))
i don't know what circleci supports, but here there is:
$ nc --help | grep EOF
--send-only Only send data, ignoring received; quit on EOF
--no-shutdown Continue half-duplex when receiving EOF on stdin
@sogaiu your PR stalls: https://circleci.com/gh/borkdude/babashka/2132?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link
iiuc, the netcat that's here is not entirely a niche implementation -- i think it is: https://nmap.org/ncat/
i have been confused by what you mean by "repl client" -- you mean something that will initiate a net conn and use that?
https://github.com/borkdude/babashka/issues/137 mentions "repl client" too
clj -r
gives a nice repl -- no network -- this is not functionality that exists in bb, right?
I'm not totally sure about #137 though, since it will encourage people to type in a REPL prompt while you can better just connect from an editor. Or maybe an answer to 137 could be: use tubular.
137 probably doesn't involve a socket server, but only exposing the REPL to stdout/stdin
@holyjak Merged your PR. Maybe you could give it a try locally again before I bake a new version of bb
seems to work fine!
@sogaiu maybe we can just borrow this stuff to test the server: https://github.com/borkdude/tubular/blob/master/src/clj_sockets/core.clj
@sogaiu I've tried emulating netcat with tubular for an hour or two, but I can't get the Ctrl-D test working
tubular has a clj-socket namespace in it which might be used for lower level testing (which I also tried, but no luck so far)
This kinda works:
(defn socket-command [expr]
(with-open [socket (<http://java.net|java.net>.Socket. "127.0.0.1" 1666)
writer (io/writer socket)
reader (io/reader socket)
sw (<http://java.io|java.io>.StringWriter.)]
(.write writer (str expr "\n"))
(.flush writer)
(.write writer (str ":repl/exit\n"))
(.flush writer)
(loop []
(when-let [l (.readLine ^<http://java.io|java.io>.BufferedReader reader)]
(binding [*out* sw]
(println l))
(recur)))
(str sw)))
but I don't know how to send ctrl-d instead of :repl/exit to verify that ctrl-d works
maybe by closing the writer?
(defn socket-command [expr]
(with-open [socket (.Socket. "127.0.0.1" 1666)
reader (io/reader socket)
sw (.StringWriter.)]
(let [writer (io/writer socket)]
(.write writer (str expr "\n"))
(.flush writer)
;; (.close writer)
(.write writer (str ":repl/exit\n"))
(loop []
(when-let [l (.readLine ^.BufferedReader reader)]
(binding [*out* sw]
(println l))
(recur)))
(str sw))))
@sogaiu I went ahead and simplified the socket REPL tests without using netcat now, at the cost of deleting the ctrl-d test
babashka v0.0.38 released: https://github.com/borkdude/babashka/releases/tag/v0.0.38