I have a silly little problem I can’t figure out. For internal reasons, I need to load my packages from a custom path with
Pkg.activate("~/myPackage"). The thing is, we run it on the command line (here Julia 1.9 and
PrecompileTools have been a life saver) but what is bugging us is the message it prints out. When we run
julia -e 'using Pkg;Pkg.activate("~/myPackage/"); using myPackage;RunMyCode()
it prints out
Activating project at ~/myPackage/myPackage`
is there any way to surpress this message, or do the same in a way that runs the code silently?
I know this is silly, but it bothers people here.
@nilshg Wow, yes, works perfectly. (I should have found that by googling, sorry)
Pkg functions take an
io keyword argument that allows redirecting their output (or suppressing it by redirecting to
$ julia -e 'import Pkg; Pkg.activate("/tmp", io=devnull); println("Hello!")'
I think it’s unfortunate that
Pkg API calls give these outputs; it should be enough to do that in
pkg mode and with pkg-strings. In this particular case there’s an easy workaround though, use the
julia --project=~/myPackage -e 'using myPackage;RunMyCode()'
I dont know how I missed that but is very logical. Thanks @ffevotte.
Thanks @GunnarFarneback, another good solution, now for the command line. And since almost all my code is run this way, very nice. As to your general point, I agree.