Fork me on GitHub

hello, i have a tmux session called test, i want to use babashka to attach the session

(shell/sh "tmux" "attach-session" "-t" "test")
it shows the error
{:exit 1, :out "", :err "open terminal failed: not a terminal\n"}
how can i do?


Use babashka process with inherit true


(-> (process ["tmux" "attach-session" "-t" "test"] {:inherit true}) check)
maybe should use like this, thanks

👍 1
Ian Fernandez20:01:21

bb.edn supports aliases?


@U9ABG0ERZ It doesn't. Why do you need this?

Ian Fernandez20:01:01

I have a task that have the deps for run it, but I want to have an easier way to run a repl without running the execution on task itself


maybe just add the deps to the top level :deps?

Ian Fernandez20:01:30

It would be good to have the deps only for a certain path that I load

Ian Fernandez20:01:43

that runs 1 script

Ian Fernandez20:01:04

I have 2 tasks primarly


for the repl you could make a script repl.clj and put (babashka.deps/add-deps '{:deps ...}) in it, and load that in the REPL

Ian Fernandez20:01:33

A & B A should not load the deps that B needs

Ian Fernandez20:01:03

something like this


having more dependencies on the bb classpath doesn't affect performance, unless you really load those namespaces


so usually it's ok to add all of them to :deps


but you can load those deps in the REPL dynamically too


with said function

👍 1
Ian Fernandez20:01:09

yeah, should be better to load it from deps.edn

Frank Henard21:01:32

Does anyone know of a way to pull a dependency from an s3 repository for babashka? We use the s3-wagon-private leiningen plugin to deploy the library. The url looks something like this


Should work the same as with deps.edn , only then in bb.edn

Rob Haisfield23:01:33

I’m trying to use fs/create-file, but I only seem to be able to get it to work when it’s a file from within my project folder. Is it possible to create files in directories outside of my project folder?


Sure, you just need to provide an absolute path and create parent directories with fs/create-dirs


So something like

(doto (fs/file "/tmp/foo/bar/baz") (-> fs/parent fs/create-dirs) fs/create-file)

Rob Haisfield18:02:36

I’m confused… why do I need to create new parent directories?


if you are writing a file /tmp/foo/bar/baz but the parent directories do not exist, then you need to create them first. if they already exist, then it should just work without creating those.

Rob Haisfield19:02:55

Yeah they should already exist… but when I run these functions it returns false. Would this be a system permissions thing for my code editor?


I get the confusion. ~ isn't expanded, but there is an expand-home function for this


~ is a bash thing really, not a Java or Clojure thing

Rob Haisfield19:02:58

Ah I see… Got it. Still have an issue though - I’ve got the recent version of fs in my project dependencies, but now when I try to run that function, it says No such var: fs/expand-home

Rob Haisfield19:02:50

(fs/expand-home "~/Dropbox/Notes/Test/")


can you paste a complete project.clj here? then I can try it locally? you can remove almost anything but the :dependencies

Rob Haisfield19:02:35

(defproject functions-for-processing-notes "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url ""
  :license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
            :url ""}
  :dependencies [[org.clojure/clojure "1.10.3"]
                 [dk.ative/docjure "1.14.0"]
                 [com.rpl/specter "1.1.3"]
                 [babashka/fs "0.1.2"]
                 [orchestra "2021.01.01-1"]
                 [lambdaisland/deep-diff2 "2.0.108"]
                 [org.clojars.arthurbarroso/lovelace "0.1.2"]]

  :repl-options {:init-ns functions-for-processing-notes.core})


functions-for-processing-notes.core=> (require '[babashka.fs :as fs])
functions-for-processing-notes.core=> (fs/expand-home "~/Dropbox/foo")
#object[sun.nio.fs.UnixPath 0x628c30e8 "/Users/borkdude/Dropbox/foo"]


works here...

Rob Haisfield16:02:08

Weird… these are the only options that show up for me on autocomplete too


which editor / environment is this? it might be an older version of babashka


or are you using babashka.fs on the JVM?


sorry I lose track of 10s of conversations happening interleaved ;)

Rob Haisfield16:02:49

Yes, I’m using babashka.fs on the JVM in Calva

Rob Haisfield16:02:58

No worries! I appreciate the help you’re giving me


ok, if you have the newest version then you should be seeing that function.

Rob Haisfield16:02:52

[babashka/fs "0.1.2"] is that not the newest version?


it is. I don't know why the tooling doesn't show you that function

Rob Haisfield16:02:07

It’s not just that the tooling isn’t showing the function… when I try to eval, it says No such var: fs/expand-home


In emacs CIDER it is showing correctly:


ok, then something is clearly wrong with your dependencies. :)


What do you see for (System/getProperty "java.class.path")


don't paste the entire output here, but only the part that is concerning babashka.fs

Rob Haisfield17:02:31


Rob Haisfield17:02:46

Hmm why would it have that if my dependencies has the correct version?


ok, so this is a pretty old version of babashka.fs, there you have it :)


try lein deps :tree to see what else might be pulling in babashka fs.


maybe you're using a lein profile. who knows.