diff --git a/src/Composer/EventDispatcher/EventDispatcher.php b/src/Composer/EventDispatcher/EventDispatcher.php
index 25bfb8f7c..efd05d22c 100644
--- a/src/Composer/EventDispatcher/EventDispatcher.php
+++ b/src/Composer/EventDispatcher/EventDispatcher.php
@@ -174,7 +174,7 @@ class EventDispatcher
$flags = $event->getFlags();
if (substr($callable, 0, 10) === '@composer ') {
$exec = $this->getPhpExecCommand() . ' ' . ProcessExecutor::escape(getenv('COMPOSER_BINARY')) . ' ' . implode(' ', $args);
- if (0 !== ($exitCode = $this->process->execute($exec))) {
+ if (0 !== ($exitCode = $this->process->execute($exec, $ignoredOutput, null, $this->io->isInteractive()))) {
$this->io->writeError(sprintf('Script %s handling the %s event returned with error code '.$exitCode.'', $callable, $event->getName()), true, IOInterface::QUIET);
throw new ScriptExecutionException('Error Output: '.$this->process->getErrorOutput(), $exitCode);
@@ -248,7 +248,7 @@ class EventDispatcher
}
}
- if (0 !== ($exitCode = $this->process->execute($exec))) {
+ if (0 !== ($exitCode = $this->process->execute($exec, $ignoredOutput, null, $this->io->isInteractive()))) {
$this->io->writeError(sprintf('Script %s handling the %s event returned with error code '.$exitCode.'', $callable, $event->getName()), true, IOInterface::QUIET);
throw new ScriptExecutionException('Error Output: '.$this->process->getErrorOutput(), $exitCode);
diff --git a/src/Composer/Util/ProcessExecutor.php b/src/Composer/Util/ProcessExecutor.php
index c16953652..905d012e7 100644
--- a/src/Composer/Util/ProcessExecutor.php
+++ b/src/Composer/Util/ProcessExecutor.php
@@ -41,7 +41,7 @@ class ProcessExecutor
* @param string $cwd the working directory
* @return int statuscode
*/
- public function execute($command, &$output = null, $cwd = null)
+ public function execute($command, &$output = null, $cwd = null, $tty = false)
{
if ($this->io && $this->io->isDebug()) {
$safeCommand = preg_replace_callback('{://(?P[^:/\s]+):(?P[^@\s/]+)@}i', function ($m) {
@@ -70,6 +70,9 @@ class ProcessExecutor
} else {
$process = new Process($command, $cwd, null, null, static::getTimeout());
}
+ if (!Platform::isWindows() && $tty) {
+ $process->setTty(true);
+ }
$callback = is_callable($output) ? $output : array($this, 'outputHandler');
$process->run($callback);