Skip to content
This repository has been archived by the owner on Sep 20, 2021. It is now read-only.

Processus::run does not work on Windows #79

Open
Hywan opened this issue Feb 21, 2017 · 16 comments
Open

Processus::run does not work on Windows #79

Hywan opened this issue Feb 21, 2017 · 16 comments

Comments

@Hywan
Copy link
Member

Hywan commented Feb 21, 2017

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.

@Hywan
Copy link
Member Author

Hywan commented Feb 21, 2017

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.

@lukbukkit
Copy link

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
Copy link
Member Author

Hywan commented Feb 22, 2017

Please, what version of Windows are you running?

@lukbukkit
Copy link

lukbukkit commented Feb 22, 2017 via email

@Hywan
Copy link
Member Author

Hywan commented Feb 22, 2017

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

@lukbukkit
Copy link

Does it work for you on Windows 10?

@Hywan
Copy link
Member Author

Hywan commented Feb 22, 2017

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

@lukbukkit
Copy link

lukbukkit commented Feb 22, 2017

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
Copy link
Member Author

Hywan commented Feb 28, 2017

@lukbukkit Thanks!

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

@lukbukkit
Copy link

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

@Hywan
Copy link
Member Author

Hywan commented Mar 24, 2017

@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
Copy link
Member Author

Hywan commented Mar 24, 2017

@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
Copy link
Member Author

Hywan commented Apr 24, 2017

ping ❤️?

@lukbukkit
Copy link

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
Copy link
Member Author

Hywan commented Sep 5, 2017

ping <3 ?

@lukbukkit
Copy link

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

2 participants