This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-02-07
Channels
- # aleph (4)
- # announcements (9)
- # babashka (44)
- # beginners (6)
- # cider (8)
- # clj-kondo (5)
- # clojars (10)
- # clojure (10)
- # clojure-berlin (1)
- # clojure-dev (9)
- # clojure-europe (20)
- # clojure-gamedev (1)
- # clojure-miami (2)
- # clojure-nl (1)
- # clojure-norway (21)
- # clojure-uk (5)
- # clojurescript (12)
- # conjure (1)
- # cursive (19)
- # data-science (2)
- # datahike (10)
- # etaoin (5)
- # events (3)
- # fulcro (14)
- # gratitude (2)
- # honeysql (8)
- # humbleui (1)
- # hyperfiddle (60)
- # introduce-yourself (7)
- # jobs-discuss (27)
- # juxt (2)
- # kaocha (7)
- # lsp (23)
- # malli (9)
- # missionary (2)
- # off-topic (48)
- # pathom (24)
- # releases (1)
- # shadow-cljs (256)
- # sql (46)
- # xtdb (19)
this upcoming clojure.java.process
NS looks very nice so far, BUT i'd like it to be more debuggable.
when i use process/exec
i'd like to see what was the final, effective command line and environment variables of the executed process.
to do that, i could switch to using process/start
, so i can do (doto (-> :process ^ProcessHandle$Info .info .commandLine .get prn))
, BUT then i would lose the rest of the process/exec
functionality.
and i still don't how to obtain the effective process environment, though it was already available during the use of the ProcessBuilder
.
here is a complete example, in case anyone wants to start looking into this question:
(-> (clojure.java.process/start
{:out :inherit :err :inherit :env {"ASD" "123"}}
"bash" "-c" "echo $ASD")
(doto (-> :process ^java.lang.ProcessHandle$Info .info .commandLine .get prn)))
so when my "production code" is just
(-> (clojure.java.process/exec
{:out :inherit :err :inherit :env {"ASD" "123"}}
"bash" "-c" "echo $ASD"))
what would be the least invasive way to modify this expression to obtain the command-line and process-environment values?Can you put this on http://ask.clojure.org and focus on the problem you’re trying to solve? What are you trying to debug and why?
@U086D6TBN babashka.process returns a record with :cmd
in it, FWIW:
$ bb -e '(:cmd (babashka.process/process "ls"))'
["ls"]
(in-ns 'clj-http.conn-mgr)
(instance? ReuseableAsyncConnectionManager
(proxy [PoolingNHttpClientConnectionManager ReuseableAsyncConnectionManager]
[(make-ioreactor nil) nil (into-registry {}) nil nil 2.0
java.util.concurrent.TimeUnit/SECONDS])) ;; => false
ohhh scratch this, sorry for the noise.
There's some sort of code reloading issue, since after a jvm restart that code returns true
https://ask.clojure.org/index.php/3352/proxy-super-threadsafe-should-made-safe-documented-unsafe is something to watch out for depending how complicated your proxy usage is