flex: Symfony Flex breaks interactivity of Composer scripts

Hi,

I have a composer script defined:

{
    "scripts": {
        "post-install-cmd": [
            "My\\Cool\\ScriptHandler::run"
        ],
        "post-update-cmd": [
            "My\\Cool\\ScriptHandler::run"
        ]
    }
}

which works, except for one difference: the given InputStream is non-interactive.

<?php

use Composer\Script\Event;

class ScriptHandler
{
    public function handle (Event $event)
    {
        var_dump($event->getIO()->isInteractive());
    }
}

The problem is flex, as this short snipped shows:

$ composer run-script parameters
> My\Cool\ScriptHandler::handle
bool(false)


$ composer remove symfony/flex
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 0 installs, 0 updates, 1 removal
  - Removing symfony/flex (v1.0.60)
[...]


$ composer run-script parameters
> My\Cool\ScriptHandler::handle
bool(true)

This currently makes implementing something similar to incenteev/composer-parameter-handler in combination with running flex impossible.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 18 (17 by maintainers)

Commits related to this issue

Most upvoted comments

Quick reproducer on my side:

composer create-project symfony/skeleton app
cd app && composer req friendsofsymfony/elastica-bundle

Symfony operations: 1 recipe (87cd049614f216146bb961668dd54270)
  -  IGNORING  friendsofsymfony/elastica-bundle (>=5.0): From github.com/symfony/recipes-contrib:master

I can confirm isInteractive is false at this point.