mirror of
https://github.com/composer/composer
synced 2025-05-11 09:32:55 +00:00
Pass devMode from RunScriptCommand to Script\Event
This commit is contained in:
parent
ff7daf0bd4
commit
71e0fba216
2 changed files with 10 additions and 3 deletions
|
@ -12,7 +12,7 @@
|
|||
|
||||
namespace Composer\Command;
|
||||
|
||||
use Composer\Script\CommandEvent;
|
||||
use Composer\Script\Event as ScriptEvent;
|
||||
use Composer\Script\ScriptEvents;
|
||||
use Composer\Util\ProcessExecutor;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
|
@ -81,7 +81,9 @@ EOT
|
|||
}
|
||||
|
||||
$composer = $this->getComposer();
|
||||
$hasListeners = $composer->getEventDispatcher()->hasEventListeners(new CommandEvent($script, $composer, $this->getIO()));
|
||||
$devMode = $input->getOption('dev') || !$input->getOption('no-dev');
|
||||
$event = new ScriptEvent($script, $composer, $this->getIO(), $devMode);
|
||||
$hasListeners = $composer->getEventDispatcher()->hasEventListeners($event);
|
||||
if (!$hasListeners) {
|
||||
throw new \InvalidArgumentException(sprintf('Script "%s" is not defined in this package', $script));
|
||||
}
|
||||
|
@ -96,7 +98,7 @@ EOT
|
|||
ProcessExecutor::setTimeout((int) $timeout);
|
||||
}
|
||||
|
||||
return $composer->getEventDispatcher()->dispatchScript($script, $input->getOption('dev') || !$input->getOption('no-dev'), $args);
|
||||
return $composer->getEventDispatcher()->dispatchScript($script, $devMode, $args);
|
||||
}
|
||||
|
||||
protected function listScripts()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue