PHP proc_open not receiving data from Go script

97 Views Asked by At

I'm currently using the ReactPHP Child-Process library (which uses proc_open()) to get data from a Go application in stream format. However, when I dump all input from stdout and stderr, I get nothing even though when I test it in bash I get output.

Here is the Go script: https://github.com/bwmarrin/dca/blob/master/main.go

The Go script uses goroutines so that may be the issue? (Not sure, I'm not a Go developer and I didn't make the program.)

I'm running on Mac OS X 10.11.2 El Capitan with PHP 7.0.3 CLI.

PHP Code:

$loop = Factory::create();

$process = new Process("dca -i /Users/david/Music/Zombies.mp3");

$process->start($loop);
$process->stdout->on('data', function ($data) {
    var_dump($data);
});
$process->stderr->on('data', function ($data) {
    dump($data);
});

$loop->run();

React Child-Process can be found here: https://github.com/reactphp/child-process

0

There are 0 best solutions below