1
0
Fork 0

Add support for sourcing binaries despite the bin proxy being present

Fixes https://github.com/composer/composer/issues/10389#issuecomment-1007372740
pull/10432/head
Jordi Boggiano 2022-01-07 14:28:53 +01:00
parent d9619985db
commit 6dea58c9f3
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 9 additions and 2 deletions

View File

@ -397,9 +397,16 @@ PROXY;
return <<<PROXY return <<<PROXY
#!/usr/bin/env sh #!/usr/bin/env sh
self=\$(realpath \$0 2> /dev/null) # Support bash to support `source` with fallback on $0 if this does not run with bash
# https://stackoverflow.com/a/35006505/6512
selfArg="\$BASH_SOURCE"
if [ -z "\$selfArg" ]; then
selfArg="\$0"
fi
self=\$(realpath \$selfArg 2> /dev/null)
if [ -z "\$self" ]; then if [ -z "\$self" ]; then
self="\$0" self="\$selfArg"
fi fi
dir=\$(cd "\${self%[/\\\\]*}" > /dev/null; cd $binDir && pwd) dir=\$(cd "\${self%[/\\\\]*}" > /dev/null; cd $binDir && pwd)