Skip to content

Commit

Permalink
[BUGFIX] Add fallback if executed via composer's xdebug-handler
Browse files Browse the repository at this point in the history
  • Loading branch information
vertexvaar committed Dec 24, 2024
1 parent 7e99200 commit f322fcc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/bluecontainer/src/Composer/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Symfony\Component\Process\Process;

use function CoStack\Lib\concat_paths;
use function getcwd;
use function str_ends_with;

class Plugin implements PluginInterface, EventSubscriberInterface
Expand Down Expand Up @@ -45,7 +46,7 @@ public function postAutoloadDump(): void
{
$this->io->write('Generating container');

$binary = $_ENV['_'];
$binary = $_ENV['_'] ?? '';
if (!str_ends_with($binary, 'php')) {
$binary = 'php';
}
Expand All @@ -57,7 +58,7 @@ public function postAutoloadDump(): void
$cmd[] = $binary;
$cmd[] = $blueContainerBinary;
$cmd[] = 'compile';
$process = new Process($cmd, $_ENV['PWD'], $_ENV, null, 60 * 60);
$process = new Process($cmd, $_ENV['PWD'] ?? getcwd(), $_ENV, null, 60 * 60);
$process->run();
if (!$process->isSuccessful()) {
$this->io->writeError('Failed generating DI container');
Expand Down

0 comments on commit f322fcc

Please sign in to comment.