1
0
Fork 0

Fix support for .jar binaries, fixes #10426

pull/10430/head
Jordi Boggiano 2022-01-04 14:55:56 +01:00
parent 8486b38fef
commit fa65804c99
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 11 additions and 2 deletions

View File

@ -158,6 +158,10 @@ class BinaryInstaller
return trim($match[1]);
}
if (substr($bin, -4) === '.jar') {
return 'java -jar ';
}
return 'php';
}
@ -224,7 +228,7 @@ class BinaryInstaller
$binPath = $this->filesystem->findShortestPath($link, $bin);
$caller = self::determineBinaryCaller($bin);
// if the target is a php file, we run the unixy proxy file
// if the target is a php file, we run the unixy proxy file (a php script in this case)
// to ensure that _composer_autoload_path gets defined, instead
// of running the binary directly
if ($caller === 'php') {
@ -394,6 +398,11 @@ include $binPathExported;
PROXY;
}
$caller = '';
if (substr($bin, -4) === '.jar') {
$caller = 'java -jar ';
}
return <<<PROXY
#!/usr/bin/env sh
@ -415,7 +424,7 @@ fi
export COMPOSER_BIN_DIR=\$(cd "\${self%[/\\\\]*}" > /dev/null; pwd)
"\${dir}/$binFile" "\$@"
$caller"\${dir}/$binFile" "\$@"
PROXY;
}