hoaproject / Console

The Hoa\Console library.

Home Page:https://hoa-project.net/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Processus::run does not work on Windows

Hywan opened this issue · comments

See hoaproject/Test#83 (comment).

For the records, my message:

Can you test those two examples and tell me which one works or not.

Example 1:

$processus = new Hoa\Console\Processus('ls');
$processus->open();
echo $processus->readAll();

Example 2:

$processus = new Hoa\Console\Processus('ls');
$processus->on('output', function (Hoa\Event\Bucket $bucket) {
    $data = $bucket->getData();
    echo '> ', $data['line'], "\n";
});
$processus->run();

Thanks!

The reply:

Test Nr.1:

CHANGELOG.md
Client.php
Connection
Exception
Node.php
Processus.php
README.md
Server.php
Socket.php
Test
Transport.php
composer.json
composer.lock
test.sh
vendor

Test Nr.2:

PHP Warning:  Invalid argument supplied for foreach() in D:\lukas\Coding\PhpstormProjects\Hoaproject\Socket\vendor\hoa\console\Processus.php on line 460

Warning: Invalid argument supplied for foreach() in D:\lukas\Coding\PhpstormProjects\Hoaproject\Socket\vendor\hoa\console\Processus.php on line 460

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Please @LukBukkit, can you remove the @ in

Console/Processus.php

Lines 401 to 407 in cc0a1bf

$out = @proc_open(
$streamName,
$this->_descriptors,
$this->_pipes,
$this->getCwd(),
$this->getEnvironment()
);
and var_dump the value of $out? Same with the value of $this->_pipes please.

commented

Sure, i wasn't wheather you wanted to have the tests or the test:run command. So here are both:

Test Nr.1:

resource(34) of type (process) # var_dump($out)
array(3) {                                # var_dump($this->_pipes)
  [0]=>
  resource(31) of type (stream)
  [1]=>
  resource(32) of type (stream)
  [2]=>
  resource(33) of type (stream)
}
CHANGELOG.md
Client.php
Connection
Exception
Node.php
Processus.php
README.md
Server.php
Socket.php
Test
Transport.php
composer.json
composer.lock
test.sh
vendor

Test Nr.2:

NULL                                   # var_dump($this->_pipes) @ line 463
PHP Warning:  Invalid argument supplied for foreach() in D:\lukas\Coding\PhpstormProjects\Hoaproject\Socket\vendor\hoa\console\Processus.php on line 465

Warning: Invalid argument supplied for foreach() in D:\lukas\Coding\PhpstormProjects\Hoaproject\Socket\vendor\hoa\console\Processus.php on line 465

vendor/bin/hoa test:run

$ vendor/bin/hoa test:run
string(329) "D:\lukas\Coding\PhpstormProjects\Hoaproject\Socket\vendor\bin\atoum --autoloader-file D:\lukas\Coding\PhpstormProjects\Hoaproject\Socket\vendor\hoa\test\.autoloader.atoum.php --configurations D:\lukas\Coding\PhpstormProjects\Hoaproject\Socket\vendor\hoa\test\.atoum.php --force-terminal --max-children-number 2 --directories Test"
Hoa\Console\Processus::_open(): (8) Array to string conversion
in D:\lukas\Coding\PhpstormProjects\Hoaproject\Socket\vendor\hoa\console\Processus.php at line 406.

Please, what version of Windows are you running?

commented

@LukBukkit Do you have an idea how I can test it myself?

commented

Does it work for you on Windows 10?

I don't have Windows at all :-(.

commented

You can grab a Windows Insider ISO or the version 1607 from Microsoft. (I think you can use this version for 90 days or so and after this period you have to reinstall it) Then put it into a VM and install XAMPP with PHP 7.0.15 or just PHP 7.0.16 for Windows and last but not least Git for Windows and maybe an editor of your choice. :)

@LukBukkit Thanks!

Also, is ls working on Windows? Isn't it dir?

commented

Yes it's dir if you use the Windows cmd, but I use the Git Bash for my tests.

@LukBukkit Really really really sorry for the too late reply. I have finally time to work on this issue. After 6h, I have a running Windows. Let's dig into this bug.

@LukBukkit I guess we have an issue. I am not able to reproduce :-/. I have PHP 5.6 installed on Windows 10 (version 1607).

ping ❤️?

commented

Sorry I was a little busy, I'll try to reproduce this and create a step for step documentation that show exactly how I broke it. I hope I can find time for this tomorrow.

ping <3 ?

commented

Hello again,
sorry I'm currently a little bit busy. When I find time I'm going to try everything again and send you the results. 😉