kubectl should allow `//` preamble for plugins to avoid exec format error
maxandersen opened this issue · 4 comments
I noticed that where a git plugin can be as follows:
git-helloworld:
//usr/bin/env bash "$0" "$@" ; exit $?
echo "a plugin"
git helloworld
a plugin
(notice the use of //
instead of #!
) if you do the same for kubectl you get:
kubectl helloworld
exec format error
"
With this it is currently a must to have your script plugin start with "#!".
This is unfortunate since if you are using go or java single script notion they will not load.
They could out "#!" in header but all current IDE's will complain about the foreign "#!".
Better if kubectl would behave similar to git and support both "#!" and "//"
context: see https://github.com/maxandersen/k8s-cli-java for real world example of this.
When invoking a kubectl plugin we use syscall.Exec
(at least on linux) and we pass the entire execution to the child process, so this is more of binary level problem not kubectl
/close
@soltysh: Closing this issue.
In response to this:
When invoking a kubectl plugin we use
syscall.Exec
(at least on linux) and we pass the entire execution to the child process, so this is more of binary level problem not kubectl
/close
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
that’s a shame. as noted other cli's, i.e. git, that uses same mechanism of - in path this works. kubectl stands out.
I tried looking in the source code but couldn't find the actual place this call is made - can you give a pointer ?