`:environment` doesn't seem to work with `PATH`
E.g. if I have the following script to print out some variables:
#!/bin/bash
echo "PATH: $PATH"
echo "LD_LIBRARY_PATH: $LD_LIBRARY_PATH"
Then at the REPL:
;; Control to show defaults.
JIX> (external-program:run "./test.sh" nil :output t)
PATH: /home/john/.pyenv/shims:/home/john/.pyenv/bin:/home/john/.cargo/bin:/home/john/src/gitlab.com/johngavingraham/util/bin:/home/john/.local/bin:/home/john/bin:/home/john/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/usr/lib64/ccache:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/var/lib/snapd/snap/bin
LD_LIBRARY_PATH:
:EXITED
0
;; PATH is not picked up, but LD_LIBRARY_PATH is.
JIX> (external-program:run "./test.sh" nil :output t :environment '(("PATH" . "foo") ("LD_LIBRARY_PATH" . "bar")))
PATH: /home/john/.pyenv/shims:/home/john/.pyenv/bin:/home/john/.cargo/bin:/home/john/src/gitlab.com/johngavingraham/util/bin:/home/john/.local/bin:/home/john/bin:/home/john/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/usr/lib64/ccache:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/var/lib/snapd/snap/bin
LD_LIBRARY_PATH: bar
:EXITED
0
;; Attempting to replace the environment, PATH is simply cleared.
JIX> (external-program:run "./test.sh" nil :output t :environment '(("PATH" . "foo") ("LD_LIBRARY_PATH" . "bar")) :replace-environment-p t)
PATH:
LD_LIBRARY_PATH: bar
:EXITED
0
Hey, I haven’t touched this library in a while, but I’m happy to keep it in working order.
Could you try running with the patch from #25? Looks like there’s a conflict there, so let me know if you don’t have luck. If that works for you, I’ll (finally) merge that.
Oh, and which Common Lisp impl are you using? This library has a lot of conditionally-compiled code.
I'll try the patch when I can - I'm on sbcl.
Also, you may want to replace your use of external-program with UIOP.
I haven’t reviewed UIOP to say that it’s definitively better than external-program (or even what different tradeoffs it may make), but considering how unmaintained external-program is, it’s a good bet UIOP is a better option.
In the short term, I’ll update the README to point people at UIOP, and maybe when I find myself more in the CL world again, I’ll evaluate UIOP myself (and hopefully retire this package).
However – I’ll still happily work to help resolve your issue if you choose to stick with external-program.