-
-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PATH is overridden when using su #451
Comments
Hi @ivarref, thanks for starting this discussion. This is by design, but it's a questionable design. Toast uses A simple workaround for your use case might be as follows: image: eclipse-temurin:11-jdk-focal
command_prefix: export PATH="/opt/java/openjdk/bin:$PATH"
tasks:
java_version:
command: java -version Update: What I previously wrote here was not quite right. I previously thought this was a general issue with environment variables provided by the Docker image, but now I see it only affects certain environment variables like |
Thanks for the quick reply @stepchowfun and suggested fix! Would it be possible to avoid using Thanks again. |
That's an interesting idea, but I have a couple of concerns:
My current thinking is that it's not worth it. I understand how this feature would be useful, though. |
Description
It seems that PATH is overridden when using su. This is not the case when using docker directly.
Instructions to reproduce the bug
$ cat toast.yml image: eclipse-temurin:11-jdk-focal tasks: java_version: command: java -version $ toast [INFO] Ready to run 1 task: java_version. [INFO] Running task java_version… bash: java: command not found
Example correct output using docker directly:
$ docker run -t eclipse-temurin:11-jdk-focal java -version openjdk version "11.0.17" 2022-10-18 OpenJDK Runtime Environment Temurin-11.0.17+8 (build 11.0.17+8) OpenJDK 64-Bit Server VM Temurin-11.0.17+8 (build 11.0.17+8, mixed mode, sharing)
I suspect this is because
su
is invoked, and that the PATH environment variable is then overridden.Environment information:
Linux 5.15.76-1-MANJARO #1 SMP PREEMPT Sat Oct 29 14:22:16 UTC 2022 x86_64 GNU/Linux
Is there any way to fix this?
Thanks for an interesting and good project!
The text was updated successfully, but these errors were encountered: