hoaproject / Console

The Hoa\Console library.
https://hoa-project.net/
366 stars 32 forks source link

Processus::run does not work on Windows #79

Open Hywan opened 7 years ago

Hywan commented 7 years ago

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!](https://www.bountysource.com/issues/42260890-processus-run-does-not-work-on-windows?utm_campaign=plugin&utm_content=tracker%2F459935&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F459935&utm_medium=issues&utm_source=github).
Hywan commented 7 years ago

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.

lukbukkit commented 7 years ago

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.
Hywan commented 7 years ago

Please, what version of Windows are you running?

lukbukkit commented 7 years ago

I'm running Windows 10 1607

Ivan Enderlin notifications@github.com 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 .

Hywan commented 7 years ago

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

lukbukkit commented 7 years ago

Does it work for you on Windows 10?

Hywan commented 7 years ago

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

lukbukkit commented 7 years ago

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. :)

Hywan commented 7 years ago

@LukBukkit Thanks!

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

lukbukkit commented 7 years ago

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

Hywan commented 7 years ago

@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 commented 7 years ago

@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 commented 7 years ago

ping ❤️?

lukbukkit commented 7 years ago

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.

Hywan commented 7 years ago

ping <3 ?

lukbukkit commented 7 years ago

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