mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-11-15 01:28:17 -07:00
fix: warn when any ./lib/commands are marked as executable (#1593)
This commit is contained in:
parent
b320803120
commit
2043a09574
12
bin/asdf
12
bin/asdf
@ -92,6 +92,18 @@ asdf_cmd() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -x "$ASDF_CMD_FILE" ]; then
|
if [ -x "$ASDF_CMD_FILE" ]; then
|
||||||
|
# When '$ASDF_CMD_FILE' is an executable, we are executing a command directly from a plugin.
|
||||||
|
# Example: https://github.com/asdf-community/asdf-nim/blob/397c14a7f04ad5b91963814afc2e9cc92366e1c5/lib/commands/command-install-deps.bash
|
||||||
|
# In those cases, the path to that command is always an absolute path. However, this codepath can also be activated if a user accidentally
|
||||||
|
# marks files in ./lib/commands/* as executable. This code detects when that happens and prints a useful warning message.
|
||||||
|
if [[ "$ASDF_CMD_FILE" == ./lib/commands/* ]]; then
|
||||||
|
printf '%s\n' "----------"
|
||||||
|
printf '%s\n' "asdf: Warning: You are executing an asdf command from \$ASDF_DIR, but we detected that some files have been"
|
||||||
|
printf '%s\n' " erroneously marked as executable. All files under '$ASDF_DIR/lib/commands' must NOT be marked"
|
||||||
|
printf '%s\n' " as executable. Otherwise, asdf will not be able to source its core files"
|
||||||
|
printf '%s\n' "----------"
|
||||||
|
fi >&2
|
||||||
|
|
||||||
exec "$ASDF_CMD_FILE" "${@:${args_offset}}"
|
exec "$ASDF_CMD_FILE" "${@:${args_offset}}"
|
||||||
elif [ -f "$ASDF_CMD_FILE" ]; then
|
elif [ -f "$ASDF_CMD_FILE" ]; then
|
||||||
set -- "${@:${args_offset}}"
|
set -- "${@:${args_offset}}"
|
||||||
|
Loading…
Reference in New Issue
Block a user