infureal / artisan-gui

Simple but yet powerful library for running almost all artisan commands.
https://packagist.org/packages/infureal/artisan-gui
356 stars 56 forks source link

Undefined constant STDIN when command is interactive #32

Closed jeremy379 closed 2 years ago

jeremy379 commented 2 years ago

Hello

I encounter an issue (beta v2) while trying command with interactive question (using $this->ask() or variant of it). Do you plan to support this in the next version?

This code will produce an error

exception: "Error"
file: "/home/vagrant/code/platform/vendor/symfony/console/Helper/QuestionHelper.php"
line: 113
message: "Undefined constant \"STDIN\""

Code example to reproduce the issue :

class MyTestCommand extends Command
{
    protected $signature = 'test';
    protected $description = 'Test command';

    public function handle()
    {

        $this->ask('hello ? ');

        return 0;
    }
}
infureal commented 2 years ago

STDIN (standart output) is disabled for php-cgi. It works only in cli. So you cannot realtime promt user for answer.