Skip to content

Commit

Permalink
Add support for sourcing binaries despite the bin proxy being present
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed Jan 7, 2022
1 parent d961998 commit 6dea58c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/Composer/Installer/BinaryInstaller.php
Expand Up @@ -397,9 +397,16 @@ public function url_stat(\$path, \$flags)
return <<<PROXY
#!/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
self="\$0"
self="\$selfArg"
fi
dir=\$(cd "\${self%[/\\\\]*}" > /dev/null; cd $binDir && pwd)
Expand Down

0 comments on commit 6dea58c

Please sign in to comment.