This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-07-12
Channels
- # announcements (2)
- # babashka (22)
- # babashka-sci-dev (15)
- # beginners (62)
- # calva (2)
- # cider (8)
- # clj-kondo (33)
- # clojure (52)
- # clojure-europe (46)
- # clojure-losangeles (1)
- # clojure-norway (5)
- # clojure-spec (7)
- # clojurescript (31)
- # conjure (20)
- # data-science (4)
- # datalevin (16)
- # fulcro (28)
- # hyperfiddle (71)
- # introduce-yourself (3)
- # lsp (50)
- # off-topic (16)
- # polylith (8)
- # portal (3)
- # practicalli (1)
- # reitit (1)
- # releases (2)
- # tools-build (22)
- # vim (8)
- # xtdb (17)
I am not sure but can it be that on jvm the process/shell
does not print the error to stderr?
(ns foo
(:require
[babashka.process :as process]))
(process/shell "ls" "nothing")
running with bb
will say ls: no such file
but with a jvm program it doesn't
(process/shell "ls" "nothing")
Execution error (ExceptionInfo) at babashka.process/check (process.cljc:111).
shell just uses the system's stdout. Are you in a JVM REPL? CIDER hacks may cause things to behave differently
I suspected the same thing. For some reason that must be hacks on the nrepl interaction layer because the cider eval layer doesn't see this stderr. Just the message of the exception.
I’m stumbling with process, too, atm. I’m trying two things:
1. have a wrapper that’ll always pass {:dir "my-dir"}
2. feed a string into stdin for one call.
I think I’ve realized that I cannot do (2.) with process/shell, so I’ve tried it using process/process, but it fails with a null pointer exception:
----- Error --------------------------------------------------------------------
Type: java.lang.NullPointerException
Location: /Users/stephan/Sources/StyraInc/example-api-authz-go/e2e/test/data-kafka/data_kafka_test.clj:25:3
----- Context ------------------------------------------------------------------
21:
22: (def messages "{\"id\": \"bob\", \"permissions\": {\"path\": [\"cars\"], \"method\":\"GET\"}}\n")
23:
24: (defn publish-messages []
25: (process/process {:dir "test/data-kafka" :in "messages"}) "docker compose run -T kcat -P -b broker:29092 -t users")
^---
26:
(problem (1.) is just a lack of knowledge of clojure basics, I’m afraid)
well — I’m sure that is true for problem (2.), too 🙃
in line 25 above, it’s "messages"
(quotes), because I wanted to make it simpler; ideally, I’d feed it the string from line 22.
:man-facepalming: there’s a stray )
there
in line 25.
🥳 it works. I don’t think I actually need (1.) urgently now… I can’t pass :in
to shell (or my shell wrapper) anyways.
(shell {:in "something"} "command")
is possible? I’ve misread the docs then
great, thank you.
very happy to find https://github.com/babashka/instaparse-bb today after getting a parser working against the jvm - dropped it into the bb.edn deps and ran tests against babashka, and they all passed! and it's suspiciously fast 😄 Much for this and at large!
❯ time bb test-jvm
[(..................................................................)]
3 tests, 66 assertions, 0 failures.
bb test-jvm 25.42s user 0.94s system 580% cpu 4.539 total
❯ time bb test-bb
Testing godot-edn.parse-test
Ran 3 tests containing 66 assertions.
0 failures, 0 errors.
bb test-bb 0.05s user 0.04s system 14% cpu 0.657 total