Closed
Description
My composer.json
:
I don't have composer.json because I don't have a project.
Output of composer diagnose
:
Checking platform settings: OK
Checking git settings: OK git version 2.34.1
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com rate limit: OK
Checking disk free space: OK
Checking pubkeys:
Tags Public Key Fingerprint: 57815BA2 7E54DC31 7ECC7CC5 573090D0 87719BA6 8F3BB723 4E5D42D0 84A14642
Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B 0C708369 153E328C AD90147D AFE50952
OK
Checking composer version: OK
Composer version: 2.5-dev+b6028951b8a2254d4896b4dd13bcbe380a3d51bf
PHP version: 8.1.9
PHP binary path: /usr/bin/php8.1
OpenSSL version: OpenSSL 3.0.2 15 Mar 2022
cURL version: 7.81.0 libz 1.2.11 ssl OpenSSL/3.0.2
zip: extension present, unzip present, 7-Zip not available
When I run this command:
composer upd[TAB][TAB]
Here I can't see the autocompletion for root user and the shell terminal is blocked. I can't cancel with CTRL+C. I must close the terminal window.
I get the following output:
root@php:~# composer upd[TAB][TAB]
And I expected this to happen:
I expected to see autocompleted commands for root user.
I debugged the issue and I found the completion command is:
php /usr/local/bin/composer _complete -sbash -c1 -S2.4.1 -icomposer
and when I execute this command as root, composer ask confirmation because I'm root:
root@php:~# php /usr/local/bin/composer _complete -sbash -c1 -S2.4.1 -icomposer
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Continue as root/super user [yes]?
Possible solutions
Maybe we never autocomplete for root, but it must not block the shell.
Or maybe we always autocomplete for root and we never ask confirmation, like this :
php /usr/local/bin/composer _complete -sbash -c1 -S2.4.1 -icomposer --no-interaction --no-plugins