Console icon indicating copy to clipboard operation
Console copied to clipboard

Processus::run does not work on Windows

Open Hywan opened this issue 8 years ago • 16 comments

See https://github.com/hoaproject/Test/issues/83#issuecomment-281019576.

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.

Hywan avatar Feb 21 '17 08:02 Hywan

Please @LukBukkit, can you remove the @ in https://github.com/hoaproject/Console/blob/cc0a1bf3e90391d72434674290e05781b665cc4b/Processus.php#L401-L407 and var_dump the value of $out? Same with the value of $this->_pipes please.

Hywan avatar Feb 21 '17 08:02 Hywan

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.

lukbukkit avatar Feb 21 '17 19:02 lukbukkit

Please, what version of Windows are you running?

Hywan avatar Feb 22 '17 07:02 Hywan

I'm running Windows 10 1607

Ivan Enderlin [email protected] schrieb am Mi., 22. Feb. 2017, 08:21:

Please, what version of Windows are you running?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/hoaproject/Console/issues/79#issuecomment-281589721, or mute the thread https://github.com/notifications/unsubscribe-auth/AHskQsz-6wwOAFwbEJiauHnm87Qdn0g1ks5re-H-gaJpZM4MHBg2 .

lukbukkit avatar Feb 22 '17 12:02 lukbukkit

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

Hywan avatar Feb 22 '17 13:02 Hywan

Does it work for you on Windows 10?

lukbukkit avatar Feb 22 '17 15:02 lukbukkit

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

Hywan avatar Feb 22 '17 15:02 Hywan

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 avatar Feb 22 '17 15:02 lukbukkit

@LukBukkit Thanks!

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

Hywan avatar Feb 28 '17 15:02 Hywan

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

lukbukkit avatar Feb 28 '17 16:02 lukbukkit

@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.

Hywan avatar Mar 24 '17 13:03 Hywan

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

Hywan avatar Mar 24 '17 14:03 Hywan

ping ❤️?

Hywan avatar Apr 24 '17 19:04 Hywan

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.

lukbukkit avatar Apr 26 '17 19:04 lukbukkit

ping <3 ?

Hywan avatar Sep 05 '17 13:09 Hywan

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. 😉

lukbukkit avatar Sep 08 '17 15:09 lukbukkit