I have created a process using proc-open
but under windows the stream-select does not work. What I am trying to achieve is to read from both stdout and stderr, whilst in addition writing to stdin and ensure that the output can be matched up with the inputs. Is there a workaround for windows to overcome this deficiency?
You are not very detailed on what is not working for you with stream-select on Windows. However, this is a working example on how to use stream-select. I just ran this successfully with PHP 5.4 on Windows XP.
Edit: Uhhmmm.. Seems like it was non-working after all... Sry, testing some more here.. :)
Edit again:
So, I did some more experimenting on this, but unsuccessfully.
Maybe you should just let the processes speak TCP/UDP/IP to each other?
Another way forward (if you still want to use stdout/stdin/stderr in your process) might be to use proc_open with file handlers, so your process is writing to files, and then use something similar to unix' inotify, loading this stuff with the PHP DOTNET class: Is there anything like inotify on Windows? to detect changes to the files...? Just an idea...
Or maybe change to a unix-like os? ;) Ok, that's it for me tonight. Good night
adding bypass_shell worked for me
$proc=proc_open($cmd,
array(
0=>array('pipe', 'r'), //stdin
1=>array('pipe', 'w'), //stdout
2=>array('pipe', 'w') //stderr
),
$pipes,
$dir,
null,
array('bypass_shell'=>true)
);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With