Skip to content

Commit

Permalink
proccess timeout fix. The hooks are not honoring the composer default.
Browse files Browse the repository at this point in the history
  • Loading branch information
fran6co committed Jul 12, 2012
1 parent b2b18d7 commit fd46abe
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions Composer/ScriptHandler.php
Expand Up @@ -31,7 +31,7 @@ public static function buildBootstrap($event)
return;
}

static::executeBuildBootstrap($appDir);
static::executeBuildBootstrap($appDir, $options['process-timeout']);
}

public static function clearCache($event)
Expand All @@ -45,7 +45,7 @@ public static function clearCache($event)
return;
}

static::executeCommand($event, $appDir, 'cache:clear --no-warmup');
static::executeCommand($event, $appDir, 'cache:clear --no-warmup', $options['process-timeout']);
}

public static function installAssets($event)
Expand Down Expand Up @@ -123,25 +123,25 @@ public static function doBuildBootstrap($appDir)
", substr(file_get_contents($file), 5)));
}

protected static function executeCommand($event, $appDir, $cmd)
protected static function executeCommand($event, $appDir, $cmd, $timeout = 300)
{
$php = escapeshellarg(self::getPhp());
$console = escapeshellarg($appDir.'/console');
if ($event->getIO()->isDecorated()) {
$console.= ' --ansi';
}

$process = new Process($php.' '.$console.' '.$cmd, null, null, null, 300);
$process = new Process($php.' '.$console.' '.$cmd, null, null, null, $timeout);
$process->run(function ($type, $buffer) { echo $buffer; });
}

protected static function executeBuildBootstrap($appDir)
protected static function executeBuildBootstrap($appDir, $timeout = 300)
{
$php = escapeshellarg(self::getPhp());
$cmd = escapeshellarg(__DIR__.'/../Resources/bin/build_bootstrap.php');
$appDir = escapeshellarg($appDir);

$process = new Process($php.' '.$cmd.' '.$appDir, null, null, null, 300);
$process = new Process($php.' '.$cmd.' '.$appDir, null, null, null, $timeout);
$process->run(function ($type, $buffer) { echo $buffer; });
}

Expand All @@ -155,6 +155,8 @@ protected static function getOptions($event)

$options['symfony-assets-install'] = getenv('SYMFONY_ASSETS_INSTALL') ?: $options['symfony-assets-install'];

$options['process-timeout'] = $event->getComposer()->getConfig()->get('process-timeout');

return $options;
}

Expand Down

0 comments on commit fd46abe

Please sign in to comment.