Skip to content

Commit 0f0797b

Browse files
authored
Only execute Python interpreters (#536)
Fixes #535 This checks if the interpreter is anything with python or pypy in it. Thus, avoiding executing e.g. `php -m argcomplete._check_console_script ...` (which succeeds).
1 parent 3344816 commit 0f0797b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

argcomplete/bash_completion.d/_python-argcomplete

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,8 @@ _python_argcomplete_global() {
193193
if (__python_argcomplete_scan_head_noerr "$SCRIPT_NAME" easy_install \
194194
&& "${interpreter[@]}" "$(__python_argcomplete_which python-argcomplete-check-easy-install-script)" "$SCRIPT_NAME") >/dev/null 2>&1; then
195195
ARGCOMPLETE=1
196-
elif __python_argcomplete_run "${interpreter[@]}" -m argcomplete._check_console_script "$SCRIPT_NAME"; then
196+
elif ([[ "${interpreter[@]}" == *python* ]] || [[ "${interpreter[@]}" == *pypy* ]])\
197+
&& __python_argcomplete_run "${interpreter[@]}" -m argcomplete._check_console_script "$SCRIPT_NAME"; then
197198
ARGCOMPLETE=1
198199
fi
199200
fi

0 commit comments

Comments
 (0)