Problem
The run-parallel executable cannot find Composer's autoloader when a project uses a custom vendor-dir.
Our project has this Composer configuration:
{
"config": {
"vendor-dir": "client-mu-plugins/vendor"
}
}
The executable is therefore installed at:
client-mu-plugins/vendor/bin/run-parallel
Running it from the project root:
client-mu-plugins/vendor/bin/run-parallel --command="composer lint"
fails with:
Class "Symfony\\Component\\Console\\Output\\ConsoleOutput" not found
The package bootstrap currently checks fixed paths and getcwd() . '/vendor/autoload.php'. None of those paths point to the custom Composer vendor directory when the command runs from the project root.
Composer's generated binary proxy already provides the correct autoloader path through:
$GLOBALS['_composer_autoload_path']
Request
Could the bootstrap use Composer's provided autoloader path when it is available?
For example:
if (isset($GLOBALS['_composer_autoload_path'])) {
require_once $GLOBALS['_composer_autoload_path'];
return;
}
The existing fallback paths could remain for cases where the executable is not launched through Composer's binary proxy.
Current workaround
We must first change into the custom vendor directory's parent, then tell run-parallel to execute commands from the project root:
cd client-mu-plugins \
&& vendor/bin/run-parallel --cwd=.. --command="composer lint"
This works, but it ties the command to our vendor directory layout. Supporting Composer's generated autoloader path would make the executable work directly from the project root.
Problem
The
run-parallelexecutable cannot find Composer's autoloader when a project uses a customvendor-dir.Our project has this Composer configuration:
{ "config": { "vendor-dir": "client-mu-plugins/vendor" } }The executable is therefore installed at:
Running it from the project root:
client-mu-plugins/vendor/bin/run-parallel --command="composer lint"fails with:
The package bootstrap currently checks fixed paths and
getcwd() . '/vendor/autoload.php'. None of those paths point to the custom Composer vendor directory when the command runs from the project root.Composer's generated binary proxy already provides the correct autoloader path through:
Request
Could the bootstrap use Composer's provided autoloader path when it is available?
For example:
The existing fallback paths could remain for cases where the executable is not launched through Composer's binary proxy.
Current workaround
We must first change into the custom vendor directory's parent, then tell
run-parallelto execute commands from the project root:This works, but it ties the command to our vendor directory layout. Supporting Composer's generated autoloader path would make the executable work directly from the project root.