Running in sbt command "eval $(minikube docker-env)" !! log give exception.
[error] java.io.IOException: Cannot run program "eval": error=2, No such file or directory
but same command in bash script
#!/usr/bin/env bash
eval $(minikube docker-env)
Runn as "eval.sh" !! log
Work fine.
I can't understand why. Please explain.
eval is a shell feature. There is no way to call it from java to set up the environment for future commands the way you can for a shell.
If you want to run a second command from Java that depends on doing eval "$(minikube docker-env)" first, you can instead run a single shell with both commands:
String shellCommand = "eval \"$(minikube docker-env)\"; your-second-command";
Runtime.exec(new String[] { "sh", "-c", shellCommand });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With